WARNING: The 2.x versions of Elasticsearch have passed their EOL dates. If you are running a 2.x version, we strongly advise you to upgrade.
This documentation is no longer maintained and may be removed. For the latest information, see the current Elasticsearch documentation.
Mapping Geohashesedit
The first step is to decide just how much precision you need. Although you could
index all geo-points with the default full 12 levels of precision, do you
really need to be accurate to within a few centimeters? You can save yourself
a lot of space in the index by reducing your precision requirements to
something more realistic, such as 1km
:
PUT /attractions { "mappings": { "restaurant": { "properties": { "name": { "type": "string" }, "location": { "type": "geo_point", "geohash_prefix": true, "geohash_precision": "1km" } } } } }
Setting |
|
The precision can be specified as an absolute number, representing the
length of the geohash, or as a distance. A precision of |
With this mapping in place, geohash prefixes of lengths 1 to 7 will be indexed, providing geohashes accurate to about 150 meters.