Geo Coordinates Match

geo_distance query allows you to perform proximity searches based on geographic coordinates and allows you to find documents that are within a specified distance from a given geographical point. The query uses the following terms -

  • "distance" - Specifies the distance within which you want to search. This can be expressed in units like "km" (kilometers), "mi" (miles), "m" (meters), "yd" (yards) and "ft" (feet).

  • "point" - Specifies the point around which to center, in geo coordinates "lat", "lon".

Example:

{
  "query": {
    "geo_distance": {
      "distance": "10km",
      "point": {
        "lat": 31.19,
        "lon": -44.41
      }
    }
  }
}

In the above example, the query is looking for documents with a field named "point", whose value is within a 10-kilometer radius of the coordinates (31.19, -44.41)

Last updated