
Elasticsearch 5.x Cookbook
By :

When you are working with geolocations, one common task is to filter results based on the distance from a location. This scenario covers very common site requirements such as:
Finding the nearest restaurant within a distance of 20 km
Finding my nearest friends within a range of 10 km
The geo_distance
query is used to achieve this goal.
You need an up-and-running Elasticsearch installation as we described in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
To execute curl
via the command line, you need to install curl
for your operating system.
To correctly execute the following commands, you need an index populated with the chapter_07/populate_geo.sh
geoscript available in the online code.
To execute a geo_distance
query, we will perform the following steps:
Searching documents in which pin.location
is 200km
away from lat
40
and lon
as 70
is done with a similar query:
curl -XGET 'http://127...
Change the font size
Change margin width
Change background colour