The next step after searching in Elasticsearch is to execute the aggregations. The elastic4s DSL also provides support for aggregation so that it can be built in a safer typed way.
Executing a search with aggregations
Getting ready
You need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe in Chapter 1, Getting Started.
An IDE that supports Scala programming, such as IntelliJ IDEA, with the Scala plugin should be installed globally.
The code for this recipe can be found in the ch14/elastic4s_sample file and the referred class is AggregationExample.