33using System . Threading . Tasks ;
44using Elastic . Clients . Elasticsearch ;
55using Elastic . Clients . Elasticsearch . Aggregations ;
6+ using Elastic . Clients . Elasticsearch . Core . Search ;
67using Exceptionless . DateTimeExtensions ;
78using Foundatio . Parsers . ElasticQueries . Visitors ;
89using Foundatio . Parsers . LuceneQueries . Extensions ;
@@ -16,9 +17,9 @@ public static class DefaultAggregationNodeExtensions
1617 // NOTE: We may want to read this dynamically from server settings.
1718 public const int MAX_BUCKET_SIZE = 10000 ;
1819
19- public static Task < AggregationMap > GetDefaultAggregationAsync ( this IQueryNode node , IQueryVisitorContext context )
20+ public static async Task < AggregationMap > GetDefaultAggregationAsync ( this IQueryNode node , IQueryVisitorContext context )
2021 {
21- AggregationBase aggregation = null ;
22+ AggregationMap aggregation = null ;
2223 if ( node is GroupNode groupNode )
2324 aggregation = await groupNode . GetDefaultAggregationAsync ( context ) ;
2425
@@ -28,17 +29,17 @@ public static Task<AggregationMap> GetDefaultAggregationAsync(this IQueryNode no
2829 if ( aggregation is null )
2930 return null ;
3031
31- if ( aggregation is ITermsAggregation termsAggregation )
32+ if ( aggregation is TermsAggregation termsAggregation )
3233 {
3334 PopulateTermsAggregation ( termsAggregation , node ) ;
3435 }
3536
36- if ( aggregation is ITopHitsAggregation topHitsAggregation )
37+ if ( aggregation is TopHitsAggregation topHitsAggregation )
3738 {
3839 PopulateTopHitsAggregation ( topHitsAggregation , node ) ;
3940 }
4041
41- if ( aggregation is IDateHistogramAggregation histogramAggregation )
42+ if ( aggregation is DateHistogramAggregation histogramAggregation )
4243 {
4344 PopulateDateHistogramAggregation ( histogramAggregation , node ) ;
4445 }
@@ -387,7 +388,7 @@ private static Union<CalendarInterval, Duration> GetInterval(DateTime? utcStart,
387388 return null ;
388389 }
389390
390- private static void PopulateTermsAggregation ( ITermsAggregation termsAggregation , IQueryNode node )
391+ private static void PopulateTermsAggregation ( TermsAggregation termsAggregation , IQueryNode node )
391392 {
392393 if ( termsAggregation is null )
393394 return ;
@@ -425,7 +426,7 @@ private static void PopulateTermsAggregation(ITermsAggregation termsAggregation,
425426 case "@min" :
426427 {
427428 if ( ! String . IsNullOrEmpty ( termNode . Term ) && Int32 . TryParse ( termNode . UnescapedTerm , out int minCount ) )
428- termsAggregation . MinimumDocumentCount = minCount ;
429+ termsAggregation . MinDocCount = minCount ;
429430 break ;
430431 }
431432 }
@@ -434,7 +435,7 @@ private static void PopulateTermsAggregation(ITermsAggregation termsAggregation,
434435 }
435436 }
436437
437- private static void PopulateTopHitsAggregation ( ITopHitsAggregation topHitsAggregation , IQueryNode node )
438+ private static void PopulateTopHitsAggregation ( TopHitsAggregation topHitsAggregation , IQueryNode node )
438439 {
439440 if ( topHitsAggregation is null )
440441 return ;
@@ -481,7 +482,7 @@ private static void PopulateTopHitsAggregation(ITopHitsAggregation topHitsAggreg
481482 }
482483 }
483484
484- private static void PopulateDateHistogramAggregation ( IDateHistogramAggregation dateHistogramAggregation , IQueryNode node )
485+ private static void PopulateDateHistogramAggregation ( DateHistogramAggregation dateHistogramAggregation , IQueryNode node )
485486 {
486487 if ( dateHistogramAggregation is null )
487488 return ;
0 commit comments