Add support for nested aggregations and filtered aggregations

This commit is contained in:
Caleb Champlin
2020-10-17 13:42:50 -06:00
parent f7d496389e
commit 39f0dd59c1
5 changed files with 212 additions and 0 deletions
+34
View File
@@ -58,5 +58,39 @@ func TestAggregations(t *testing.T) {
},
},
},
{
"a complex, multi-aggregation, nested",
Aggregate(
NestedAgg("categories","categories").
Aggs(TermsAgg("type","outdoors")),
FilterAgg("filtered",
Term("type", "t-shirt")),
),
map[string]interface{}{
"aggs": map[string]interface{}{
"categories": map[string]interface{}{
"nested": map[string]interface{}{
"path": "categories",
},
"aggs": map[string]interface{} {
"type": map[string]interface{} {
"terms": map[string]interface{} {
"field": "outdoors",
},
},
},
},
"filtered": map[string]interface{}{
"filter": map[string]interface{}{
"term": map[string]interface{}{
"type": map[string]interface{} {
"value": "t-shirt",
},
},
},
},
},
},
},
})
}