@@ -154,8 +154,17 @@ public interface IAggregationContainer
154
154
IMinBucketAggregation MinBucket { get ; set ; }
155
155
156
156
[ JsonProperty ( "sum_bucket" ) ]
157
- ISumBucketAggregation SumBucket { get ; set ; }
158
-
157
+ ISumBucketAggregation SumBucket { get ; set ; }
158
+
159
+ [ JsonProperty ( "stats_bucket" ) ]
160
+ IStatsBucketAggregation StatsBucket { get ; set ; }
161
+
162
+ [ JsonProperty ( "extended_stats_bucket" ) ]
163
+ IExtendedStatsBucketAggregation ExtendedStatsBucket { get ; set ; }
164
+
165
+ [ JsonProperty ( "percentiles_bucket" ) ]
166
+ IPercentilesBucketAggregation PercentilesBucket { get ; set ; }
167
+
159
168
[ JsonProperty ( "moving_avg" ) ]
160
169
IMovingAverageAggregation MovingAverage { get ; set ; }
161
170
@@ -242,8 +251,14 @@ public class AggregationContainer : IAggregationContainer
242
251
243
252
public IMinBucketAggregation MinBucket { get ; set ; }
244
253
245
- public ISumBucketAggregation SumBucket { get ; set ; }
246
-
254
+ public ISumBucketAggregation SumBucket { get ; set ; }
255
+
256
+ public IStatsBucketAggregation StatsBucket { get ; set ; }
257
+
258
+ public IExtendedStatsBucketAggregation ExtendedStatsBucket { get ; set ; }
259
+
260
+ public IPercentilesBucketAggregation PercentilesBucket { get ; set ; }
261
+
247
262
public IMovingAverageAggregation MovingAverage { get ; set ; }
248
263
249
264
public ICumulativeSumAggregation CumulativeSum { get ; set ; }
@@ -349,8 +364,14 @@ public class AggregationContainerDescriptor<T> : DescriptorBase<AggregationConta
349
364
350
365
IMinBucketAggregation IAggregationContainer . MinBucket { get ; set ; }
351
366
352
- ISumBucketAggregation IAggregationContainer . SumBucket { get ; set ; }
353
-
367
+ ISumBucketAggregation IAggregationContainer . SumBucket { get ; set ; }
368
+
369
+ IStatsBucketAggregation IAggregationContainer . StatsBucket { get ; set ; }
370
+
371
+ IExtendedStatsBucketAggregation IAggregationContainer . ExtendedStatsBucket { get ; set ; }
372
+
373
+ IPercentilesBucketAggregation IAggregationContainer . PercentilesBucket { get ; set ; }
374
+
354
375
IMovingAverageAggregation IAggregationContainer . MovingAverage { get ; set ; }
355
376
356
377
ICumulativeSumAggregation IAggregationContainer . CumulativeSum { get ; set ; }
@@ -497,8 +518,20 @@ public AggregationContainerDescriptor<T> MinBucket(string name,
497
518
498
519
public AggregationContainerDescriptor < T > SumBucket ( string name ,
499
520
Func < SumBucketAggregationDescriptor , ISumBucketAggregation > selector ) =>
500
- _SetInnerAggregation ( name , selector , ( a , d ) => a . SumBucket = d ) ;
501
-
521
+ _SetInnerAggregation ( name , selector , ( a , d ) => a . SumBucket = d ) ;
522
+
523
+ public AggregationContainerDescriptor < T > StatsBucket ( string name ,
524
+ Func < StatsBucketAggregationDescriptor , IStatsBucketAggregation > selector ) =>
525
+ _SetInnerAggregation ( name , selector , ( a , d ) => a . StatsBucket = d ) ;
526
+
527
+ public AggregationContainerDescriptor < T > ExtendedStatsBucket ( string name ,
528
+ Func < ExtendedStatsBucketAggregationDescriptor , IExtendedStatsBucketAggregation > selector ) =>
529
+ _SetInnerAggregation ( name , selector , ( a , d ) => a . ExtendedStatsBucket = d ) ;
530
+
531
+ public AggregationContainerDescriptor < T > PercentilesBucket ( string name ,
532
+ Func < PercentilesBucketAggregationDescriptor , IPercentilesBucketAggregation > selector ) =>
533
+ _SetInnerAggregation ( name , selector , ( a , d ) => a . PercentilesBucket = d ) ;
534
+
502
535
public AggregationContainerDescriptor < T > MovingAverage ( string name ,
503
536
Func < MovingAverageAggregationDescriptor , IMovingAverageAggregation > selector ) =>
504
537
_SetInnerAggregation ( name , selector , ( a , d ) => a . MovingAverage = d ) ;
@@ -521,8 +554,8 @@ public AggregationContainerDescriptor<T> BucketSelector(string name,
521
554
522
555
public AggregationContainerDescriptor < T > Sampler ( string name ,
523
556
Func < SamplerAggregationDescriptor < T > , ISamplerAggregation > selector ) =>
524
- _SetInnerAggregation ( name , selector , ( a , d ) => a . Sampler = d ) ;
525
-
557
+ _SetInnerAggregation ( name , selector , ( a , d ) => a . Sampler = d ) ;
558
+
526
559
/// <summary>
527
560
/// Fluent methods do not assign to properties on `this` directly but on IAggregationContainers inside `this.Aggregations[string, IContainer]
528
561
/// </summary>
@@ -534,27 +567,27 @@ Func<TAggregator, TAggregatorInterface> selector
534
567
where TAggregator : IAggregation , TAggregatorInterface , new ( )
535
568
where TAggregatorInterface : IAggregation
536
569
{
537
- var aggregator = selector ( new TAggregator ( ) ) ;
538
-
539
- //create new isolated container for new aggregator and assign to the right property
570
+ var aggregator = selector ( new TAggregator ( ) ) ;
571
+
572
+ //create new isolated container for new aggregator and assign to the right property
540
573
var container = new AggregationContainer ( ) { Meta = aggregator . Meta } ;
541
574
542
- assignToProperty ( container , aggregator ) ;
543
-
544
- //create aggregations dictionary on `this` if it does not exist already
575
+ assignToProperty ( container , aggregator ) ;
576
+
577
+ //create aggregations dictionary on `this` if it does not exist already
545
578
IAggregationContainer self = this ;
546
- if ( self . Aggregations == null ) self . Aggregations = new Dictionary < string , IAggregationContainer > ( ) ;
547
-
548
- //if the aggregator is a bucket aggregator (meaning it contains nested aggregations);
579
+ if ( self . Aggregations == null ) self . Aggregations = new Dictionary < string , IAggregationContainer > ( ) ;
580
+
581
+ //if the aggregator is a bucket aggregator (meaning it contains nested aggregations);
549
582
var bucket = aggregator as IBucketAggregation ;
550
583
if ( bucket != null && bucket . Aggregations . HasAny ( ) )
551
- {
552
- //make sure we copy those aggregations to the isolated container's
553
- //own .Aggregations container (the one that gets serialized to "aggs")
584
+ {
585
+ //make sure we copy those aggregations to the isolated container's
586
+ //own .Aggregations container (the one that gets serialized to "aggs")
554
587
IAggregationContainer d = container ;
555
588
d . Aggregations = bucket . Aggregations ;
556
- }
557
- //assign the aggregations container under Aggregations ("aggs" in the json)
589
+ }
590
+ //assign the aggregations container under Aggregations ("aggs" in the json)
558
591
self . Aggregations [ key ] = container ;
559
592
return this ;
560
593
}
@@ -565,4 +598,4 @@ public void Accept(IAggregationVisitor visitor)
565
598
new AggregationWalker ( ) . Walk ( this , visitor ) ;
566
599
}
567
600
}
568
- }
601
+ }
0 commit comments