File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed
Tests/Aggregations/Bucket/Terms Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,19 @@ public DocCountBucket<SignificantTermItem> SignificantTerms(string key)
100
100
} ;
101
101
}
102
102
103
- public Bucket < KeyedBucketItem > Terms ( string key ) => GetBucket < KeyedBucketItem > ( key ) ;
103
+ public TermsBucket Terms ( string key )
104
+ {
105
+ var bucket = this . TryGet < BucketDto > ( key ) ;
106
+ return bucket == null
107
+ ? null
108
+ : new TermsBucket
109
+ {
110
+ DocCountErrorUpperBound = bucket . DocCountErrorUpperBound ,
111
+ SumOtherDocCount = bucket . SumOtherDocCount ,
112
+ Items = bucket . Items . OfType < KeyedBucketItem > ( ) . ToList ( ) ,
113
+ Meta = bucket . Meta
114
+ } ;
115
+ }
104
116
105
117
public Bucket < HistogramItem > Histogram ( string key )
106
118
{
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . Linq ;
4
+ using System . Threading . Tasks ;
5
+
6
+ namespace Nest
7
+ {
8
+ public class TermsBucket : Bucket < KeyedBucketItem >
9
+ {
10
+ public long ? DocCountErrorUpperBound { get ; set ; }
11
+ public long ? SumOtherDocCount { get ; set ; }
12
+ }
13
+ }
Original file line number Diff line number Diff line change @@ -94,6 +94,8 @@ protected override void ExpectResponse(ISearchResponse<Project> response)
94
94
response . IsValid . Should ( ) . BeTrue ( ) ;
95
95
var states = response . Aggs . Terms ( "states" ) ;
96
96
states . Should ( ) . NotBeNull ( ) ;
97
+ states . DocCountErrorUpperBound . Should ( ) . HaveValue ( ) ;
98
+ states . SumOtherDocCount . Should ( ) . HaveValue ( ) ;
97
99
foreach ( var item in states . Items )
98
100
{
99
101
item . Key . Should ( ) . NotBeNullOrEmpty ( ) ;
You can’t perform that action at this time.
0 commit comments