@@ -38,6 +38,13 @@ public partial interface ISearchRequest : ITypedSearchRequest
3838 [ DataMember ( Name = "explain" ) ]
3939 bool ? Explain { get ; set ; }
4040
41+ /// <summary>
42+ /// BETA: Allows for retrieving a list of document fields in the search response.
43+ /// <para>This functionality is in beta and is subject to change. </para>
44+ /// </summary>
45+ [ DataMember ( Name = "fields" ) ]
46+ Fields Fields { get ; set ; }
47+
4148 /// <summary>
4249 /// The starting from index of the hits to return. Defaults to 0.
4350 /// </summary>
@@ -172,6 +179,12 @@ public partial interface ISearchRequest : ITypedSearchRequest
172179 /// </summary>
173180 [ DataMember ( Name = "pit" ) ]
174181 IPointInTime PointInTime { get ; set ; }
182+
183+ /// <summary>
184+ /// Specifies runtime fields which exist only as part of the query.
185+ /// </summary>
186+ [ DataMember ( Name = "runtime_mappings" ) ]
187+ IRuntimeFields RuntimeFields { get ; set ; }
175188 }
176189
177190 [ ReadAs ( typeof ( SearchRequest < > ) ) ]
@@ -198,6 +211,8 @@ public partial class SearchRequest
198211 /// <inheritdoc />
199212 public bool ? Explain { get ; set ; }
200213 /// <inheritdoc />
214+ public Fields Fields { get ; set ; }
215+ /// <inheritdoc />
201216 public int ? From { get ; set ; }
202217 /// <inheritdoc />
203218 public IHighlight Highlight { get ; set ; }
@@ -242,6 +257,8 @@ public partial class SearchRequest
242257 public bool ? Version { get ; set ; }
243258 /// <inheritdoc />
244259 public IPointInTime PointInTime { get ; set ; }
260+ /// <inheritdoc />
261+ public IRuntimeFields RuntimeFields { get ; set ; }
245262
246263 protected override HttpMethod HttpMethod =>
247264 RequestState . RequestParameters ? . ContainsQueryString ( "source" ) == true
@@ -285,6 +302,7 @@ public partial class SearchDescriptor<TInferDocument> where TInferDocument : cla
285302 IFieldCollapse ISearchRequest . Collapse { get ; set ; }
286303 Fields ISearchRequest . DocValueFields { get ; set ; }
287304 bool ? ISearchRequest . Explain { get ; set ; }
305+ Fields ISearchRequest . Fields { get ; set ; }
288306 int ? ISearchRequest . From { get ; set ; }
289307 IHighlight ISearchRequest . Highlight { get ; set ; }
290308 IDictionary < IndexName , double > ISearchRequest . IndicesBoost { get ; set ; }
@@ -307,6 +325,7 @@ public partial class SearchDescriptor<TInferDocument> where TInferDocument : cla
307325 bool ? ISearchRequest . TrackTotalHits { get ; set ; }
308326 bool ? ISearchRequest . Version { get ; set ; }
309327 IPointInTime ISearchRequest . PointInTime { get ; set ; }
328+ IRuntimeFields ISearchRequest . RuntimeFields { get ; set ; }
310329
311330 protected sealed override void RequestDefaults ( SearchRequestParameters parameters ) => TypedKeys ( ) ;
312331
@@ -335,6 +354,17 @@ public SearchDescriptor<TInferDocument> Source(Func<SourceFilterDescriptor<TInfe
335354 /// <inheritdoc cref="ISearchRequest.Size" />
336355 public SearchDescriptor < TInferDocument > Take ( int ? take ) => Size ( take ) ;
337356
357+ /// <inheritdoc cref="ISearchRequest.Fields" />
358+ public SearchDescriptor < TInferDocument > Fields ( Func < FieldsDescriptor < TInferDocument > , IPromise < Fields > > fields ) =>
359+ Assign ( fields , ( a , v ) => a . Fields = v ? . Invoke ( new FieldsDescriptor < TInferDocument > ( ) ) ? . Value ) ;
360+
361+ /// <inheritdoc cref="ISearchRequest.Fields" />
362+ public SearchDescriptor < TInferDocument > Fields < TSource > ( Func < FieldsDescriptor < TSource > , IPromise < Fields > > fields ) where TSource : class =>
363+ Assign ( fields , ( a , v ) => a . Fields = v ? . Invoke ( new FieldsDescriptor < TSource > ( ) ) ? . Value ) ;
364+
365+ /// <inheritdoc cref="ISearchRequest.Fields" />
366+ public SearchDescriptor < TInferDocument > Fields ( Fields fields ) => Assign ( fields , ( a , v ) => a . DocValueFields = v ) ;
367+
338368 /// <inheritdoc cref="ISearchRequest.From" />
339369 public SearchDescriptor < TInferDocument > From ( int ? from ) => Assign ( from , ( a , v ) => a . From = v ) ;
340370
@@ -476,6 +506,14 @@ public SearchDescriptor<TInferDocument> PointInTime(string pitId)
476506 public SearchDescriptor < TInferDocument > PointInTime ( string pitId , Func < PointInTimeDescriptor , IPointInTime > pit ) =>
477507 Assign ( pit , ( a , v ) => a . PointInTime = v ? . Invoke ( new PointInTimeDescriptor ( pitId ) ) ) ;
478508
509+ /// <inheritdoc cref="ISearchRequest.RuntimeFields" />
510+ public SearchDescriptor < TInferDocument > RuntimeFields ( Func < RuntimeFieldsDescriptor < TInferDocument > , IPromise < IRuntimeFields > > runtimeFieldsSelector ) =>
511+ Assign ( runtimeFieldsSelector , ( a , v ) => a . RuntimeFields = v ? . Invoke ( new RuntimeFieldsDescriptor < TInferDocument > ( ) ) ? . Value ) ;
512+
513+ /// <inheritdoc cref="ISearchRequest.RuntimeFields" />
514+ public SearchDescriptor < TInferDocument > RuntimeFields < TSource > ( Func < RuntimeFieldsDescriptor < TSource > , IPromise < IRuntimeFields > > runtimeFieldsSelector ) where TSource : class =>
515+ Assign ( runtimeFieldsSelector , ( a , v ) => a . RuntimeFields = v ? . Invoke ( new RuntimeFieldsDescriptor < TSource > ( ) ) ? . Value ) ;
516+
479517 protected override string ResolveUrl ( RouteValues routeValues , IConnectionSettingsValues settings )
480518 {
481519 if ( Self . PointInTime is object && ! string . IsNullOrEmpty ( Self . PointInTime . Id ) && routeValues . ContainsKey ( "index" ) )
0 commit comments