@@ -84,6 +84,9 @@ public interface IAggregationContainer
84
84
[ JsonProperty ( "percentile_ranks" ) ]
85
85
IPercentileRanksAggregaor PercentileRanks { get ; set ; }
86
86
87
+ [ JsonProperty ( "top_hits" ) ]
88
+ ITopHitsAggregator TopHits { get ; set ; }
89
+
87
90
[ JsonProperty ( "aggs" ) ]
88
91
[ JsonConverter ( typeof ( DictionaryKeysAreNotPropertyNamesJsonConverter ) ) ]
89
92
IDictionary < string , IAggregationContainer > Aggregations { get ; set ; }
@@ -111,14 +114,14 @@ public class AggregationContainer : IAggregationContainer
111
114
private ISignificantTermsAggregator _significantTerms ;
112
115
private IPercentileRanksAggregaor _percentileRanks ;
113
116
117
+ private ITopHitsAggregator _topHits ;
114
118
public IAverageAggregator Average { get ; set ; }
115
119
public IValueCountAggregator ValueCount { get ; set ; }
116
120
public IMaxAggregator Max { get ; set ; }
117
121
public IMinAggregator Min { get ; set ; }
118
122
public IStatsAggregator Stats { get ; set ; }
119
123
public ISumAggregator Sum { get ; set ; }
120
124
public IExtendedStatsAggregator ExtendedStats { get ; set ; }
121
-
122
125
public IDateHistogramAggregator DateHistogram
123
126
{
124
127
get { return _dateHistogram ; }
@@ -227,6 +230,12 @@ public IPercentileRanksAggregaor PercentileRanks
227
230
set { _percentileRanks = value ; }
228
231
}
229
232
233
+ public ITopHitsAggregator TopHits
234
+ {
235
+ get { return _topHits ; }
236
+ set { _topHits = value ; }
237
+ }
238
+
230
239
private void LiftAggregations ( IBucketAggregator bucket )
231
240
{
232
241
if ( bucket == null ) return ;
@@ -290,7 +299,9 @@ public class AggregationDescriptor<T> : IAggregationContainer
290
299
IPercentileRanksAggregaor IAggregationContainer . PercentileRanks { get ; set ; }
291
300
292
301
ITermsAggregator IAggregationContainer . Terms { get ; set ; }
293
-
302
+
303
+ ITopHitsAggregator IAggregationContainer . TopHits { get ; set ; }
304
+
294
305
public AggregationDescriptor < T > Average ( string name , Func < AverageAggregationDescriptor < T > , AverageAggregationDescriptor < T > > selector )
295
306
{
296
307
return _SetInnerAggregation ( name , selector , ( a , d ) => a . Average = d ) ;
@@ -429,6 +440,12 @@ public AggregationDescriptor<T> ValueCount(string name,
429
440
return _SetInnerAggregation ( name , selector , ( a , d ) => a . ValueCount = d ) ;
430
441
}
431
442
443
+ public AggregationDescriptor < T > TopHits ( string name ,
444
+ Func < TopHitsAggregationDescriptor < T > , TopHitsAggregationDescriptor < T > > selector )
445
+ {
446
+ return _SetInnerAggregation ( name , selector , ( a , d ) => a . TopHits = d ) ;
447
+ }
448
+
432
449
private AggregationDescriptor < T > _SetInnerAggregation < TAggregation > (
433
450
string key ,
434
451
Func < TAggregation , TAggregation > selector
0 commit comments