Related Blogs
Introduction to Kibana
Aug 1, 2020, 6:19:45 PM | Anurag Srivastava
Bucket Aggregation in Elasticsearch
Aug 29, 2018, 7:15:06 PM | Anurag Srivastava
Metrics Aggregations in Elasticsearch
Aug 18, 2018, 6:02:20 PM | Anurag Srivastava
Introduction to Elasticsearch Aggregations
Aug 14, 2018, 4:47:56 PM | Anurag Srivastava
Wildcard and Boolean Search in Elasticsearch
Aug 10, 2018, 7:14:40 PM | Anurag Srivastava
Basics of Data Search in Elasticsearch
Aug 4, 2018, 7:02:21 AM | Anurag Srivastava
Top Blogs
Wildcard and Boolean Search in Elasticsearch
Aug 10, 2018, 7:14:40 PM | Anurag Srivastava
Elasticsearch REST APIs
Jul 31, 2018, 6:16:42 PM | Anurag Srivastava
How to count number of words in a HTML string and find Read time in Python 3
Jun 30, 2018, 12:07:47 PM | jitender yadav
Create a Chess board in PHP
Mar 9, 2020, 8:45:41 AM | Rocky Paul
Bucket Aggregation in Elasticsearch
Aug 29, 2018, 7:15:06 PM | Anurag Srivastava
Metrics Aggregations in Elasticsearch
Aug 18, 2018, 6:02:20 PM | Anurag Srivastava
Answers
Anurag Srivastava
Oct 7, 2020, 3:26:22 PM | Share- Facebook
- Twitter
- WhatsApp
- Linkedin
- Copy Link
There are different types of bucket aggregations but I will focus on some of the common bucket aggregations like term
aggregation, range aggregation, filters aggregation, and filter aggregation, etc. So let's start.
Term Aggregation:
In term aggregation, we use to bucket the data in the form of unique field values. for example:
In the above expression, we are creating the bucket on blog categories using the term aggregation.
Range Aggregation:
Using range aggregation we can bucket the data using a certain range like in blogs we have different views and we can
create range aggregation using blog views. By using the views fields we can bucket the data on a certain range. See the
below example:
In the above expression, we are creating buckets based on range aggregation where we are taking the views field and provided the criteria using which we want the bucket like from 0 to 50 views, 50 to 100 views, and 100 to 200 views.
Filter Aggregation:
We use filter aggregation to narrow down the number of documents used for aggregation. As the filter is used to filter out
the documents based on certain criteria and after applying the filter we can apply the aggregation. See the below example:
In the above expression first I have filtered the data with the category as DevOps and then applied the aggregation to get the average of blog views.
This way we can apply the Bucket Aggregation is Elasticsearch, if you want to know more about Aggregation in Elasticsearch then you can refer to the following blogs:
Introduction to Elasticsearch Aggregations
Metrics Aggregation in Elasticsearch
Bucket Aggregation in Elasticsearch
If you have any queries then please let me know.