File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
src/Tests/Nest.Tests.Integration/Aggregations Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,37 @@ public void Terms()
4545 . And . BeGreaterOrEqualTo ( 18 ) ;
4646 }
4747
48+ [ Test ]
49+ public void MultipleTermsInTerms ( )
50+ {
51+ var results = this . Client . Search < ElasticsearchProject > ( s => s
52+ . Size ( 0 )
53+ . Aggregations ( a => a
54+ . Nested ( "contributors" , n => n
55+ . Path ( p => p . Contributors )
56+ . Aggregations ( na => na
57+ . Terms ( "ids" , t=> t . Field ( p=> p . Contributors . First ( ) . Id ) )
58+ . Terms ( "name" , t=> t . Field ( p=> p . Contributors . First ( ) . LastName ) )
59+ )
60+ )
61+ )
62+ ) ;
63+
64+ //using the helper to return typed aggregation buckets
65+ results . IsValid . Should ( ) . BeTrue ( ) ;
66+ var bucket = results . Aggs . Nested ( "contributors" ) ;
67+ bucket . DocCount . Should ( ) . BeGreaterThan ( 1 ) ;
68+
69+ var ids = bucket . Terms ( "ids" ) ;
70+ ids . Should ( ) . NotBeNull ( ) ;
71+ ids . Items . Should ( ) . NotBeEmpty ( ) ;
72+
73+ var countryTerms = bucket . Terms ( "name" ) ;
74+ countryTerms . Should ( ) . NotBeNull ( ) ;
75+ countryTerms . Items . Should ( ) . NotBeEmpty ( ) ;
76+
77+ }
78+
4879 [ Test ]
4980 public void ReverseNested ( )
5081 {
You can’t perform that action at this time.
0 commit comments