/ Geo,
/ Bounding_box,
/ QueryGeo-bounding-box query
#
Matches documents whose geo_point field falls inside a rectangle
defined by its top-left and bottom-right corners. Coordinates are
WGS-84 degrees; filtering only (does not contribute distance scoring).
It is the cheapest geographic filter. When the region you need is a
rectangle of latitude and longitude — a map viewport, a city’s extents,
a country’s outline approximated by its bounds — the engine answers
with a single index range and no per-document geometry math.
.../ Geo,
/ Distance,
/ QueryGeo-distance query
#
Matches documents whose geo_point field lies within a great-circle
distance of a centre point. Distances are in metres.
This is the “find me things nearby” query: given one centre and one
radius, it returns exactly the documents inside that disc on the
sphere — the shape behind store locators, delivery zones and proximity
alerts.
How it works
#
The field is the same two-dimensional (lat, lon) BKD tree the other
geo queries use (points indexed in any of the three ingest forms —
object, [lon, lat] array, "lat,lon" string). Execution is
two-phase:
.../ Geo,
/ Polygon,
/ QueryGeo-polygon query
#
Matches documents whose geo_point field lies inside an arbitrary
polygon. The ring is given as points in (lat, lon) order; vertices
on the boundary count as inside, and holes can be modelled with a
concave ring.
Real regions are rarely rectangular. City limits, districts, service
areas and lakes have corners everywhere — this query filters points by
an exact ring instead of the four edges of a bounding box.
.../ Geo,
/ Shape,
/ QueryGeo-shape query
#
Matches documents whose geo_shape field relates to a query geometry by
a spatial relation. The query geometry is a GeoJSON geometry object or a
WKT string; the indexed shape was written the same way.
Where the geo_point queries ask “is this point inside my region?”,
geo_shape asks it of whole geometries — the document carries a
polygon, line or envelope (a delivery zone, a pipeline route, a parcel)
and the query tests it against another geometry.
.../ Tutorial,
/ GeoLesson 7 — Geographic search
#
From schema to data to queries: filter documents by where they are — a
coordinate, a rectangle, an arbitrary polygon, or a full geometric shape.
Pizza has two geographic field types, and picking the right one is the
whole design step:
geo_point — a single coordinate. Answers “where is this
document?” Distance, box and polygon filters run against it.geo_shape — a full geometry: point, line, polygon,
multi-variant, envelope or geometry collection. Answers “what area
does this document cover?” and supports the relation vocabulary
(intersects, within, contains, disjoint).
A store is a geo_point; the district it serves is a geo_shape.
...