This information may not apply to the latest version of Elasticsearch. For the most up to date information, see the current version of the Elasticsearch Reference.
Choosing the appropriate type of filtering—search hits, aggregations, or both—often boils down to how you want your user interface to behave. Choose the appropriate filter (or combinations) depending on how you want to display results to your user.
A non-scoring query inside a
filterclause affects both search results and aggregations.
filterbucket affects just aggregations.
post_filteraffects just search results.