Elasticsearch - exclude filter from aggregations
You can use post_filter for elasticsearch. Post filter excludes the scope of the filters from the aggregations and is perfect to build an eCommerce search for drilled down aggregations count on filters
you can build a query like the following
{ "aggs": { "agent_id": { "terms": { "field": "agent_id", "size": 10 } } }, "post_filter": { "bool": { "terms": { "agent_id": [ "58becc297513311ad81577eb" ] } } }}
Thanks