Aggregation types

Elasticsearch 2.x allows us to use three types of aggregation: metrics, buckets, and pipeline. The metrics aggregations return a metric, just like the stats aggregation we used for the stats field. The bucket aggregations return buckets, the key and the number of documents sharing the same values, ranges, and so on, just like the terms aggregation we used for the copies field. Finally, the pipeline aggregations introduced in Elasticsearch 2.0 aggregate the output of the other aggregations and their metrics, which allows us to do even more sophisticated data analysis. Knowing all that, let's now look at all the aggregations we can use in Elasticsearch 2.x.

Metrics aggregations

We will start with the metrics aggregations, which can ...

Get Elasticsearch Server - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.