Type to search.

ES|QL ST_INTERSECTS function

Serverless

Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

Serverless interfaces and procedures might differ from classic Elastic Stack deployments.

Stack

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Returns true if two geometries intersect.

Embedded
Embedded
geomA
Expression that is either a geometry (geo_point, cartesian_point, geo_shape or cartesian_shape) or a geo-grid value (geohash, geotile, geohex). If null, the function returns null.
geomB

Expression that is either a geometry (geo_point, cartesian_point, geo_shape or cartesian_shape) or a geo-grid value (geohash, geotile, geohex). If null, the function returns null. The second parameter must also have the same coordinate system as the first. This means it is not possible to combine geo_* and cartesian_* parameters.

Returns true if two geometries intersect. They intersect if they have any point in common, including their interior points (points along lines or within polygons). This is the inverse of the ST_DISJOINT function. In mathematical terms: ST_Intersects(A, B) ⇔ A ⋂ B ≠ ∅

geomA geomB result
cartesian_point cartesian_point boolean
cartesian_point cartesian_shape boolean
cartesian_shape cartesian_point boolean
cartesian_shape cartesian_shape boolean
geo_point geo_point boolean
geo_point geo_shape boolean
geo_point geohash boolean
geo_point geohex boolean
geo_point geotile boolean
geo_shape geo_point boolean
geo_shape geo_shape boolean
geohash geo_point boolean
geohex geo_point boolean
geotile geo_point boolean
ES|QL
FROM airports
| WHERE ST_INTERSECTS(location, TO_GEOSHAPE("POLYGON((42 14, 43 14, 43 15, 42 15, 42 14))"))
abbrev:keyword city:keyword city_location:geo_point country:keyword location:geo_point name:text scalerank:i type:k
HOD Al Ḩudaydah POINT(42.9511 14.8022) Yemen POINT(42.97109630194 14.7552534413725) Hodeidah Int'l 9 mid