@@ -154,8 +154,17 @@ public interface IAggregationContainer
154154 IMinBucketAggregation MinBucket { get ; set ; }
155155
156156 [ 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+
159168 [ JsonProperty ( "moving_avg" ) ]
160169 IMovingAverageAggregation MovingAverage { get ; set ; }
161170
@@ -242,8 +251,14 @@ public class AggregationContainer : IAggregationContainer
242251
243252 public IMinBucketAggregation MinBucket { get ; set ; }
244253
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+
247262 public IMovingAverageAggregation MovingAverage { get ; set ; }
248263
249264 public ICumulativeSumAggregation CumulativeSum { get ; set ; }
@@ -349,8 +364,14 @@ public class AggregationContainerDescriptor<T> : DescriptorBase<AggregationConta
349364
350365 IMinBucketAggregation IAggregationContainer . MinBucket { get ; set ; }
351366
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+
354375 IMovingAverageAggregation IAggregationContainer . MovingAverage { get ; set ; }
355376
356377 ICumulativeSumAggregation IAggregationContainer . CumulativeSum { get ; set ; }
@@ -497,8 +518,20 @@ public AggregationContainerDescriptor<T> MinBucket(string name,
497518
498519 public AggregationContainerDescriptor < T > SumBucket ( string name ,
499520 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+
502535 public AggregationContainerDescriptor < T > MovingAverage ( string name ,
503536 Func < MovingAverageAggregationDescriptor , IMovingAverageAggregation > selector ) =>
504537 _SetInnerAggregation ( name , selector , ( a , d ) => a . MovingAverage = d ) ;
@@ -521,8 +554,8 @@ public AggregationContainerDescriptor<T> BucketSelector(string name,
521554
522555 public AggregationContainerDescriptor < T > Sampler ( string name ,
523556 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+
526559 /// <summary>
527560 /// Fluent methods do not assign to properties on `this` directly but on IAggregationContainers inside `this.Aggregations[string, IContainer]
528561 /// </summary>
@@ -534,27 +567,27 @@ Func<TAggregator, TAggregatorInterface> selector
534567 where TAggregator : IAggregation , TAggregatorInterface , new ( )
535568 where TAggregatorInterface : IAggregation
536569 {
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
540573 var container = new AggregationContainer ( ) { Meta = aggregator . Meta } ;
541574
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
545578 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);
549582 var bucket = aggregator as IBucketAggregation ;
550583 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")
554587 IAggregationContainer d = container ;
555588 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)
558591 self . Aggregations [ key ] = container ;
559592 return this ;
560593 }
@@ -565,4 +598,4 @@ public void Accept(IAggregationVisitor visitor)
565598 new AggregationWalker ( ) . Walk ( this , visitor ) ;
566599 }
567600 }
568- }
601+ }
0 commit comments