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 with 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: