Geohex grid aggregation on geo_shape MVP #90163
Labels
:Analytics/Geo
Indexing, search aggregations of geo points and shapes
>enhancement
Team:Analytics
Meta label for analytical engine team (ESQL/Aggs/Geo)
Elasticsearch already [supports geohex grid aggregations|https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohexgrid-aggregation.html], but only on
geo_point
. There is value in supporting this on fields of typegeo_shape
too. Since the related [geotile
|https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geotilegrid-aggregation.html] and [geohash
|https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohashgrid-aggregation.html] aggregations work with bothgeo_point
andgeo
shapewe can apply similar thinking to the
geohex` aggregation.The main challenge is that both
geohash
andgeotile
work with euclidean space (mercator projection) whilegeohex
is very much more spherical. As a result the underlying maths needs to take this into account. The approach used by the existinggeo_point
support is to connect the existing 2D euclidean aggregation support (using Lucene'sComponent2D
) to the underlying maths provided by Lucene'sspatial3d
library. Currently we supportgeo_point
aggregations by implementing only a small part of theComponent2D
interface. Supportinggeo_shape
could require completing this support.Update: This initial plan of using spatial3d for geohex over geo_shape was used in the prototype, but during that work we realised that polygons stored in elasticsearch are indexed with edges assumed to be lines in equirectangular projection. In order to ensure that aggregations match queries, we need to perform the aggregation in equirectangular projection too. Initially this was attempted in the prototype below, maintaining both spherical and equirectangular approaches in parallel. However, this proved to be unnecessarily complex, and performed badly (slow queries), so a new prototype was built with equirectangular-only and a focus on performance with dramatically improved results. This second attempt became the base of the production version.
h3. Sub-tasks:
h4. [Prototype|https://github.com//pull/90026]:
Component2D
support in theH3LatLonGeometry
classComponent2D
workgeo_shape
ingeohex
grid aggregationsh4. Make production ready
Marketing
The text was updated successfully, but these errors were encountered: