Closed quesurifn closed 2 years ago
[X] elastic.v7 (for Elasticsearch 7.x) [ ] elastic.v6 (for Elasticsearch 6.x) [ ] elastic.v5 (for Elasticsearch 5.x) [ ] elastic.v3 (for Elasticsearch 2.x) [ ] elastic.v2 (for Elasticsearch 1.x)
I'm trying to get aggregations like this:
"aggs": { "Total": { "global": {}, "aggs": { "user_term": { "filter": { "term": { "user.id": "kimchy" } } }, "tag_term": { "filter": { "term": { "tags": "production" } } }, "age_range_not": { "filter": { "bool": { "must_not": { "range": { "age": { "gte": 10, "lte": 20 } } } } } }, "age_range": { "filter": { "range": { "age": { "gte": 10, "lte": 20 } } } } } } }
But have been unable to get this structure. I've tried global and subquery as filters and vice versa. How do I use the provided DSL to achieve this?
@olivere Hey mate, do you have any advice here?
Which version of Elastic are you using?
[X] elastic.v7 (for Elasticsearch 7.x) [ ] elastic.v6 (for Elasticsearch 6.x) [ ] elastic.v5 (for Elasticsearch 5.x) [ ] elastic.v3 (for Elasticsearch 2.x) [ ] elastic.v2 (for Elasticsearch 1.x)
Please describe the expected behavior
I'm trying to get aggregations like this:
But have been unable to get this structure. I've tried global and subquery as filters and vice versa. How do I use the provided DSL to achieve this?