@@ -39,6 +39,13 @@ public partial interface ISearchRequest : ITypedSearchRequest
3939 [ DataMember ( Name = "explain" ) ]
4040 bool ? Explain { get ; set ; }
4141
42+ /// <summary>
43+ /// BETA: Allows for retrieving a list of document fields in the search response.
44+ /// <para>This functionality is in beta and is subject to change. </para>
45+ /// </summary>
46+ [ DataMember ( Name = "fields" ) ]
47+ Fields Fields { get ; set ; }
48+
4249 /// <summary>
4350 /// The starting from index of the hits to return. Defaults to 0.
4451 /// </summary>
@@ -173,6 +180,12 @@ public partial interface ISearchRequest : ITypedSearchRequest
173180 /// </summary>
174181 [ DataMember ( Name = "pit" ) ]
175182 IPointInTime PointInTime { get ; set ; }
183+
184+ /// <summary>
185+ /// Specifies runtime fields which exist only as part of the query.
186+ /// </summary>
187+ [ DataMember ( Name = "runtime_mappings" ) ]
188+ IRuntimeFields RuntimeFields { get ; set ; }
176189 }
177190
178191 [ ReadAs ( typeof ( SearchRequest < > ) ) ]
@@ -199,6 +212,8 @@ public partial class SearchRequest
199212 /// <inheritdoc />
200213 public bool ? Explain { get ; set ; }
201214 /// <inheritdoc />
215+ public Fields Fields { get ; set ; }
216+ /// <inheritdoc />
202217 public int ? From { get ; set ; }
203218 /// <inheritdoc />
204219 public IHighlight Highlight { get ; set ; }
@@ -243,6 +258,8 @@ public partial class SearchRequest
243258 public bool ? Version { get ; set ; }
244259 /// <inheritdoc />
245260 public IPointInTime PointInTime { get ; set ; }
261+ /// <inheritdoc />
262+ public IRuntimeFields RuntimeFields { get ; set ; }
246263
247264 protected override HttpMethod ? DynamicHttpMethod =>
248265 RequestState . RequestParameters ? . ContainsQueryString ( "source" ) == true
@@ -286,6 +303,7 @@ public partial class SearchDescriptor<TInferDocument> where TInferDocument : cla
286303 IFieldCollapse ISearchRequest . Collapse { get ; set ; }
287304 Fields ISearchRequest . DocValueFields { get ; set ; }
288305 bool ? ISearchRequest . Explain { get ; set ; }
306+ Fields ISearchRequest . Fields { get ; set ; }
289307 int ? ISearchRequest . From { get ; set ; }
290308 IHighlight ISearchRequest . Highlight { get ; set ; }
291309 IDictionary < IndexName , double > ISearchRequest . IndicesBoost { get ; set ; }
@@ -308,6 +326,7 @@ public partial class SearchDescriptor<TInferDocument> where TInferDocument : cla
308326 bool ? ISearchRequest . TrackTotalHits { get ; set ; }
309327 bool ? ISearchRequest . Version { get ; set ; }
310328 IPointInTime ISearchRequest . PointInTime { get ; set ; }
329+ IRuntimeFields ISearchRequest . RuntimeFields { get ; set ; }
311330
312331 protected sealed override void RequestDefaults ( SearchRequestParameters parameters ) => TypedKeys ( ) ;
313332
@@ -336,6 +355,17 @@ public SearchDescriptor<TInferDocument> Source(Func<SourceFilterDescriptor<TInfe
336355 /// <inheritdoc cref="ISearchRequest.Size" />
337356 public SearchDescriptor < TInferDocument > Take ( int ? take ) => Size ( take ) ;
338357
358+ /// <inheritdoc cref="ISearchRequest.Fields" />
359+ public SearchDescriptor < TInferDocument > Fields ( Func < FieldsDescriptor < TInferDocument > , IPromise < Fields > > fields ) =>
360+ Assign ( fields , ( a , v ) => a . Fields = v ? . Invoke ( new FieldsDescriptor < TInferDocument > ( ) ) ? . Value ) ;
361+
362+ /// <inheritdoc cref="ISearchRequest.Fields" />
363+ public SearchDescriptor < TInferDocument > Fields < TSource > ( Func < FieldsDescriptor < TSource > , IPromise < Fields > > fields ) where TSource : class =>
364+ Assign ( fields , ( a , v ) => a . Fields = v ? . Invoke ( new FieldsDescriptor < TSource > ( ) ) ? . Value ) ;
365+
366+ /// <inheritdoc cref="ISearchRequest.Fields" />
367+ public SearchDescriptor < TInferDocument > Fields ( Fields fields ) => Assign ( fields , ( a , v ) => a . DocValueFields = v ) ;
368+
339369 /// <inheritdoc cref="ISearchRequest.From" />
340370 public SearchDescriptor < TInferDocument > From ( int ? from ) => Assign ( from , ( a , v ) => a . From = v ) ;
341371
@@ -477,6 +507,14 @@ public SearchDescriptor<TInferDocument> PointInTime(string pitId)
477507 public SearchDescriptor < TInferDocument > PointInTime ( string pitId , Func < PointInTimeDescriptor , IPointInTime > pit ) =>
478508 Assign ( pit , ( a , v ) => a . PointInTime = v ? . Invoke ( new PointInTimeDescriptor ( pitId ) ) ) ;
479509
510+ /// <inheritdoc cref="ISearchRequest.RuntimeFields" />
511+ public SearchDescriptor < TInferDocument > RuntimeFields ( Func < RuntimeFieldsDescriptor < TInferDocument > , IPromise < IRuntimeFields > > runtimeFieldsSelector ) =>
512+ Assign ( runtimeFieldsSelector , ( a , v ) => a . RuntimeFields = v ? . Invoke ( new RuntimeFieldsDescriptor < TInferDocument > ( ) ) ? . Value ) ;
513+
514+ /// <inheritdoc cref="ISearchRequest.RuntimeFields" />
515+ public SearchDescriptor < TInferDocument > RuntimeFields < TSource > ( Func < RuntimeFieldsDescriptor < TSource > , IPromise < IRuntimeFields > > runtimeFieldsSelector ) where TSource : class =>
516+ Assign ( runtimeFieldsSelector , ( a , v ) => a . RuntimeFields = v ? . Invoke ( new RuntimeFieldsDescriptor < TSource > ( ) ) ? . Value ) ;
517+
480518 protected override string ResolveUrl ( RouteValues routeValues , IConnectionSettingsValues settings )
481519 {
482520 if ( Self . PointInTime is object && ! string . IsNullOrEmpty ( Self . PointInTime . Id ) && routeValues . ContainsKey ( "index" ) )
0 commit comments