We are just moving from SOLR, and we are facing the same problem.
You can try the global bucket and then add a query filter for each bucket:
"filter" : { "query" : { "query_string" : { "query" : "iPhone" } } }
You should end up with something like:
{ "size": 10, "query": { "query_string": { "query": "iphone" } }, "filter": { "bool": { "must": [ { "term": { "brand": "564" } }, { "term": { "color": "5" } }, { "term": { "category": "10" } } ] } }, "aggs": { "all": { "global": {}, "aggs": { "keyword": { "filter": { "bool": { "must": [ { "query": { "query_string": { "query": "iphone" } } }, { "term": { "color": "5" } }, { "term": { "category": "10" } } ] } }, "aggs": { "brand": { "terms": { "field": "brand" } } } } } } } }
source share