Elasticsearch natively supports the use of geolocation types: special types that allow localizing your document in geographic coordinates (latitude and longitude) around the world.
There are two main types used in geographic world: the point and the shape. In this recipe, we'll see geo point--the base element of geo location.
You need an up-and-running Elasticsearch installation as we described in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
The type of the field must be set to geo_point
to define a GeoPoint.
We can extend the order example adding a new field that stores the location of a customer. This will be the result:
{ "order": { "properties": { "id": { "type": "keyword", "store": "yes" }, "date": { "type": "date" }, ...