In modern applications, spatial or location-based filtering is a very common requirement, not just for filtering the results based on a location, but also as one of the driving factors of relevance. The results that are closer to the user location appear at the top of the list, the results that are not close are not removed from the list but simply placed at the bottom of the list. Elasticsearch makes it very easy to work with geographical data by combining full-text search and location-based filtering. Sorting the results based on the distance from the current user location is also supported.
To use geolocation queries, the location information should be indexed using a special mapping type. The geolocation can be stored using the geo_point mapping type if you want to store the location data in the form of latitude/longitude pairs. If you want to store...