This aggregations computes a geohash precision from a zoom
and a distance
(in pixel).
It groups points (from field
parameter) into buckets that represent geohash cells and computes each bucket's center.
Then it merges these cells if the distance between two clusters' centers is lower than the distance
parameter.
{
"aggregations": {
"<aggregation_name>": {
"geo_point_clustering": {
"field": "<field_name>",
"zoom": "<zoom>"
}
}
}
}
Input parameters :
field
: must be of type geo_point.zoom
: mandatory integer parameter between 0 and 20. It represents the zoom level used in the request to aggregate geo points.radius
: radius in pixel. It is used to compute a geohash precision then to merge cluters based on this distance. Default to50
.ratio
: ratio used to make a second merging pass. If the value is0
, no second pass is made. Default to2
.extent
: Extent of the tiles. Default to256
For example :
{
"aggregations" : {
"my_cluster_aggregation" : {
"geo_point_clustering": {
"field": "geo_point",
"zoom": 1,
"distance": 50
}
}
}
}
{
"aggregations": {
"my_cluster_aggregation": {
"buckets": [
{
"geohash_grids": [
"u0"
],
"doc_count": 90293,
"centroid": {
"lat": 48.8468417795375,
"lon": 2.331401154398918
}
}
]
}
}
}
Plugin versions are available for (at least) all minor versions of Elasticsearch since 6.0.
The first 3 digits of plugin version is Elasticsearch versioning. The last digit is used for plugin versioning under an elasticsearch version.
To install it, launch this command in Elasticsearch directory replacing the url by the correct link for your Elasticsearch version (see table)
./bin/elasticsearch-plugin install https://github.com/opendatasoft/elasticsearch-aggregation-geoclustering/releases/download/v7.0.1.0/geopoint-clustering-aggregation-7.0.1.0.zip