ES|QL spatial functions
ES|QL supports several spatial functions, all of which are aligned with the underlying spatial index grid used in Lucene:
- Geospatial predicates
ST_DISTANCEComputes the distance between two points.
ST_INTERSECTSReturns true if two geometries intersect.
ST_DISJOINTReturns whether two geometries are disjoint, sharing no points in common.
ST_CONTAINSReturns whether the first geometry contains the second geometry.
ST_WITHINReturns whether the first geometry is within the second geometry.
- Geometry functions
ST_XExtracts the x coordinate from the supplied point.
ST_YExtracts the y coordinate from the supplied point.
ST_NPOINTSCounts the number of points in the supplied geometry.
ST_BUFFERComputes a buffer area around the input geometry at the specified distance.
ST_SIMPLIFYSimplifies the input geometry using the Douglas-Peucker algorithm with a specified tolerance.
ST_SIMPLIFYPRESERVETOPOLOGYSimplifies the input geometry using a topology-preserving Douglas-Peucker algorithm.
ST_GEOMETRYTYPEReturns the geometry type of the supplied geometry as a string.
ST_DIMENSIONReturns the topological dimension of the supplied geometry.
ST_ISEMPTYReturns true if the supplied geometry is empty.
ST_ENVELOPEDetermines the minimum bounding box of the supplied geometry.
- Grid encoding functions
ST_GEOTILECalculates the geotile of the supplied geo_point at the specified precision.
ST_GEOHEXCalculates the geohex (H3 cell-id) of the supplied geo_point at the specified precision.
ST_GEOHASHCalculates the geohash of the supplied geo_point at the specified precision.