A geo_distance query finds documents whose locations fall inside a circle centered on a specified latitude and longitude. It suits nearby-venue searches, delivery areas, directions, and schools within a radius. section 12.0 section 12.1.2
Find restaurants within 175 km
GET restaurants/_search { "query": { "geo_distance": { "distance": "175 km", "location": { "lat": 50.00, "lon": 0.10 } } } } Here, distance sets the circle's radius, while location supplies its central point. The query returns restaurants within that radius. section 12.5
Use the query with these practical considerations:
- Specify distances in kilometers or miles, such as "175 km", "350 mi", or the same values without spaces. section 12.5
- Represent the central point with latitude and longitude; strings, arrays, WKT, and other supported formats are available. section 12.5
- Use geo_bounding_box for rectangular areas and geo_shape when locations or search regions require shapes rather than circles. section 12.3 section 12.4
Visualize the query as a dropped pin surrounded by a circular search area containing matching addresses. section 12.1.2
