Executing the range aggregation

The previous recipe describes an aggregation type that can be very useful if a bucket must be computed on terms or on a limited number of items. Otherwise, it's often required to return the buckets that are aggregated in ranges—the range aggregation answers this requirement. The commons scenarios in which this aggregation can be used are:

  • Price ranges (used in shops)
  • Size ranges
  • Alphabetical ranges

Getting ready

You need a working ElasticSearch cluster and an index populated with the script (chapter_06/executing_range_aggregations.sh) available at https://github.com/aparo/elasticsearch-cookbook-second-edition.

How to do it...

To execute range aggregations, we will perform the steps given as follows:

  1. We want to provide three ...

Get ElasticSearch Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.