PLEASE NOTE:
We are working on updating this book for the latest version. Some content might be out of date.
We are working on updating this book for the latest version. Some content might be out of date.
Although filtering or scoring results by geolocation is useful, it is often more useful to be able to present information to the user on a map. A search may return way too many results to be able to display each geo-point individually, but geo-aggregations can be used to cluster geo-points into more manageable buckets.
Three aggregations work with fields of type geo_point
:
-
geo_distance
- Groups documents into concentric circles around a central point.
-
geohash_grid
- Groups documents by geohash cell, for display on a map.
-
geo_bounds
-
Returns the
lat/lon
coordinates of a bounding box that would encompass all of the geo-points. This is useful for choosing the correct zoom level when displaying a map.