The filters aggregation answers the common requirement to split buckets documents using custom filters, which can be every kind of query supported by Elasticsearch.
You need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
To execute curl
via the command line, you need to install curl
for your operative system.
To correctly execute the following command, you need an index populated with the chapter_08/populate_aggregations.sh
script available in the online code.
For executing filters aggregations, we will perform the following steps:
We need to compute a filters aggregation composed by the following queries:
Date greater than 2016/01/01 and price greater or equal to 50
Date lower than 2016/01/01 and price greater or equal to 50
All the documents that are not matched
The query to execute these aggregations is as follows:
curl -XGET...