The maximum distance covered

Now, let's move on to another example of finding restaurants that are within 10 kms from my current position. Those that are beyond 10 kms are of no interest to me. So, it almost makes up to a circle with a radius of 10 km from my current position, as shown in the following map:

The maximum distance covered

Our best bet here is using a geo distance filter. It can be used as follows:

curl -XPOST 'http://localhost:9200/restaurants/_search' -d '{
  "query": {
    "filtered": {
      "filter": {
        "geo_distance": {
          "distance": "100km",
          "location": {
            "lat": 1.232,
            "lon": 1.112
          }
        }
      }
    }
  }
}'

Get Elasticsearch Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.