Geospatial queries retrieve places according to coordinates, distances, areas, or spatial relationships. They support practical searches such as nearby restaurants, homes within a radius, directions, and points of interest in an area. section 12.0 section 12.1
Elasticsearch indexes location data with geo_point for individual coordinates and geo_shape for areas or other two-dimensional shapes. Queries then compare documents with points, rectangles, distances, or shapes. section 12.1 section 12.3
Choose a query according to the spatial condition:
- geo_bounding_box finds documents inside a rectangle defined by geopoints. section 12.3
- geo_distance finds addresses or other documents within a specified distance from a point. section 12.3
- geo_shape finds documents whose shapes satisfy a relationship with a shape constructed from coordinates. section 12.3
Nearby ATMs
A location search can use geo_distance to find all ATMs within 1 km of London Bridge. The same approach supports nearby restaurants, houses within a radius, or other proximity-based results. section 12.1 section 12.3
