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.
Filtering Queries and Aggregationsedit
A natural extension to aggregation scoping are filtering queries. Because the aggregation operates in the context of the query scope, any filter applied to the query will also apply to the aggregation.