Search code examples
elasticsearchgeolocationgeospatialgeomarkerclusterer

ElasticSearch: geo point clustering


I have some rows with geo points in an ElasticSearch index. Now, I search for all rows e.g. in the radius of 5 kilometers. The result is a list with all points matching the query.

Is it possible to cluster the result in ElasticSearch to get all "hotspots"? Already found the geo centroid aggregation function of elasticsearch but that's not the thing I am searching for.

I know, it is possible to do it with libraries like Supercluster by Mapbox or something like that. But is it possible with ElasticSearch? Please see the two pictures. The second picture shows the result I want to get. Cheers!

enter image description here

enter image description here


Solution

  • I haven't used it but i think you need a geo hash grid aggregation. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohashgrid-aggregation.html

    You should be able to vary your precision and it will return geo_hash buckets with counts of docs.