Aggregations & or query

Hi,

    { 'id': 1, 'productType': 'a'}
    { 'id': 2, 'productType': 'b'}
    { 'id': 3, 'productType': 'c'}

we are doing a query with aggregations like

    {
        "aggs": {
            "productType": {
                "terms": {"field": "productType"}
            }
        }
    }

will deliver a, b, c as buckets.

if i add should block in the query with term query for 'productType' : 'a', i only have 'a' in the aggregations left.

but the aggregation is afaik unaware of the query, so is always assuming a drill down
(so also won't offer alternatives, for the current selection).

a) is there a way to also get 'b' and 'c' back? considering i want to combine them in an 'or' query?
b) is there a way to als get 'b' and 'c' back as an replacement for my current filter condition?

Thanks, Georg

You need the global aggregator to get the others back. Without it the aggregations are indeed aware of the query.

thanks together with filter it did the trick

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.