Geohash Grid Aggregation
The geohash grid aggregation groups geo-point data into geohash cells. Let’s group products by their location.
Query
GET /products/_search
{
"size": 0,
"aggs": {
"geo_grid": {
"geohash_grid": {
"field": "location",
"precision": 5
}
}
}
}
Output
{
"aggregations": {
"geo_grid": {
"buckets": [
{
"key": "dr5ru",
"doc_count": 3
},
{
"key": "dr5r6",
"doc_count": 2
}
]
}
}
}
In this example, products are grouped by their location into geohash cells with a precision of 5.
Bucket Aggregation in Elasticsearch
Elasticsearch is a robust tool not only for full-text search but also for data analytics. One of the core features that make Elasticsearch powerful is its aggregation framework, particularly bucket aggregations. Bucket aggregations allow you to group documents into buckets based on certain criteria, making it easier to analyze and summarize your data.
This article will explain what bucket aggregations are, how they work, and provide detailed examples to help you understand their usage.
Contact Us