Geographic and xy queries
Geographic and xy queries let you search fields that contain points and shapes on a map or coordinate plane. Geographic queries work on geospatial data, while xy queries work on two-dimensional coordinate data. Out of all geographic queries, the geoshape query is very similar to the xy query, but the former searches geographic fields, while the latter searches Cartesian fields.
xy queries
xy queries search for documents that contain geometries in a Cartesian coordinate system. These geometries can be specified in xy_point fields, which support points, and xy_shape fields, which support points, lines, circles, and polygons.
xy queries return documents that contain:
- xy shapes and xy points that have one of four spatial relations to the provided shape:
INTERSECTS
,DISJOINT
,WITHIN
, orCONTAINS
. - xy points that intersect the provided shape.
Geographic queries
Geographic queries search for documents that contain geospatial geometries. These geometries can be specified in geo_point fields, which support points on a map, and geo_shape fields, which support points, lines, circles, and polygons.
OpenSearch provides the following geographic query types:
- Geo-bounding box queries: Return documents with geopoint field values that are within a bounding box.
- Geodistance queries: Return documents with geopoints that are within a specified distance from the provided geopoint.
- Geopolygon queries: Return documents containing geopoints that are within a polygon.
- Geoshape queries: Return documents that contain:
- Geoshapes and geopoints that have one of four spatial relations to the provided shape:
INTERSECTS
,DISJOINT
,WITHIN
, orCONTAINS
. - Geopoints that intersect the provided shape.
- Geoshapes and geopoints that have one of four spatial relations to the provided shape: