Loading

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_DISTANCE

      Computes the distance between two points.

    • ST_INTERSECTS

      Returns true if two geometries intersect.

    • ST_DISJOINT

      Returns whether two geometries are disjoint, sharing no points in common.

    • ST_CONTAINS

      Returns whether the first geometry contains the second geometry.

    • ST_WITHIN

      Returns whether the first geometry is within the second geometry.

  • Geometry functions
    • ST_X

      Extracts the x coordinate from the supplied point.

    • ST_Y

      Extracts the y coordinate from the supplied point.

    • ST_NPOINTS

      Counts the number of points in the supplied geometry.

    • ST_BUFFER

      Computes a buffer area around the input geometry at the specified distance.

    • ST_SIMPLIFY

      Simplifies the input geometry using the Douglas-Peucker algorithm with a specified tolerance.

    • ST_SIMPLIFYPRESERVETOPOLOGY

      Simplifies the input geometry using a topology-preserving Douglas-Peucker algorithm.

    • ST_GEOMETRYTYPE

      Returns the geometry type of the supplied geometry as a string.

    • ST_DIMENSION

      Returns the topological dimension of the supplied geometry.

    • ST_ISEMPTY

      Returns true if the supplied geometry is empty.

  • ST_ENVELOPE

    Determines the minimum bounding box of the supplied geometry.

    • ST_XMAX

      Extracts the maximum x coordinate from the supplied geometry.

    • ST_XMIN

      Extracts the minimum x coordinate from the supplied geometry.

    • ST_YMAX

      Extracts the maximum y coordinate from the supplied geometry.

    • ST_YMIN

      Extracts the minimum y coordinate from the supplied geometry.

  • Grid encoding functions
    • ST_GEOTILE

      Calculates the geotile of the supplied geo_point at the specified precision.

    • ST_GEOHEX

      Calculates the geohex (H3 cell-id) of the supplied geo_point at the specified precision.

    • ST_GEOHASH

      Calculates the geohash of the supplied geo_point at the specified precision.