Skip to content

Commit 0df964e

Browse files
committed
added a test trying to capture #931 unsuccesful but the test is still good to have around
1 parent 2166c65 commit 0df964e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/Tests/Nest.Tests.Integration/Aggregations/NestedBucketAggregationTests.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff 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
{

0 commit comments

Comments
 (0)