Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Describe the issue:
I am building a faceted search query that needs to do three things, in this order:
- Match and pre-filter results.
- Return several aggregations based on various document fields, providing the counts for our facets.
- After retrieving aggregation results, apply a post-filter to the pre-filtered results.
Elasticsearch has a feature called “post-filter” which does this. This helps with implementing facets, since it’s desirable for the user to be able to view the count of different document categories even after selecting a facet for filtering. How can we replicate post-filtering in OpenSearch?