@@ -63,6 +63,9 @@ public interface ISearchRequest : IQueryPath<SearchRequestParameters>
6363 [ JsonProperty ( PropertyName = "fields" ) ]
6464 IList < PropertyPathMarker > Fields { get ; set ; }
6565
66+ [ JsonProperty ( PropertyName = "fielddata_fields" ) ]
67+ IList < PropertyPathMarker > FielddataFields { get ; set ; }
68+
6669 [ JsonProperty ( PropertyName = "script_fields" ) ]
6770 [ JsonConverter ( typeof ( DictionaryKeysAreNotPropertyNamesJsonConverter ) ) ]
6871 IDictionary < string , IScriptFilter > ScriptFields { get ; set ; }
@@ -155,6 +158,7 @@ public SearchRequest(IEnumerable<IndexNameMarker> indices, IEnumerable<TypeNameM
155158 public double ? MinScore { get ; set ; }
156159 public long ? TerminateAfter { get ; set ; }
157160 public IList < PropertyPathMarker > Fields { get ; set ; }
161+ public IList < PropertyPathMarker > FielddataFields { get ; set ; }
158162 public IDictionary < string , IScriptFilter > ScriptFields { get ; set ; }
159163 public ISourceFilter Source { get ; set ; }
160164 public IList < KeyValuePair < PropertyPathMarker , ISort > > Sort { get ; set ; }
@@ -237,6 +241,7 @@ protected override void UpdatePathInfo(IConnectionSettingsValues settings, Elast
237241 public IHighlightRequest Highlight { get ; set ; }
238242 public IRescore Rescore { get ; set ; }
239243 public IList < PropertyPathMarker > Fields { get ; set ; }
244+ public IList < PropertyPathMarker > FielddataFields { get ; set ; }
240245 public IDictionary < string , IScriptFilter > ScriptFields { get ; set ; }
241246 public ISourceFilter Source { get ; set ; }
242247 public IDictionary < string , IInnerHitsContainer > InnerHits { get ; set ; }
@@ -350,6 +355,8 @@ string ISearchRequest.Routing
350355
351356 IList < PropertyPathMarker > ISearchRequest . Fields { get ; set ; }
352357
358+ IList < PropertyPathMarker > ISearchRequest . FielddataFields { get ; set ; }
359+
353360 IDictionary < string , IScriptFilter > ISearchRequest . ScriptFields { get ; set ; }
354361
355362 ISourceFilter ISearchRequest . Source { get ; set ; }
@@ -617,6 +624,28 @@ public SearchDescriptor<T> Fields(params string[] fields)
617624 return this ;
618625 }
619626
627+ ///<summary>
628+ ///A comma-separated list of fields to return as the field data representation of a field for each hit
629+ ///</summary>
630+ public SearchDescriptor < T > FielddataFields ( params string [ ] fielddataFields )
631+ {
632+ if ( fielddataFields . HasAny ( ) )
633+ return this ;
634+ Self . FielddataFields = fielddataFields . Select ( f => ( PropertyPathMarker ) f ) . ToList ( ) ;
635+ return this ;
636+ }
637+
638+ ///<summary>
639+ ///A comma-separated list of fields to return as the field data representation of a field for each hit
640+ ///</summary>
641+ public SearchDescriptor < T > FielddataFields ( params Expression < Func < T , object > > [ ] fielddataFields )
642+ {
643+ if ( ! fielddataFields . HasAny ( ) )
644+ return this ;
645+ Self . FielddataFields = fielddataFields . Select ( f => ( PropertyPathMarker ) f ) . ToList ( ) ;
646+ return this ;
647+ }
648+
620649 public SearchDescriptor < T > ScriptFields (
621650 Func < FluentDictionary < string , Func < ScriptFilterDescriptor , ScriptFilterDescriptor > > ,
622651 FluentDictionary < string , Func < ScriptFilterDescriptor , ScriptFilterDescriptor > > > scriptFields )
0 commit comments