# How to set geohash\_precision to distance value?

**URL:** <https://discuss.elastic.co/t/how-to-set-geohash-precision-to-distance-value/95805>\
**Category:** Elasticsearch\
**Created:** [August 4, 2017, 3:51am UTC](https://discuss.elastic.co/t/how-to-set-geohash-precision-to-distance-value/95805 "2017-08-04T03:51:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Red](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@Red](https://discuss.elastic.co/u/Red)\
**Post date:** [August 4, 2017, 3:51am UTC](https://discuss.elastic.co/t/how-to-set-geohash-precision-to-distance-value/95805/1 "2017-08-04T03:51:25Z")

</div>

by default , geohash\_precision is set to absolute length, default is 12  
it can also be set to distance value, 1km, 1m ...

as i know, the distance value is fixed with difference geohash length. like this:  
1 2 3 ±23 ±23 ±2500  
2 5 5 ± 2.8 ±5.6 ±630  
3 7 8 ± 0.70 ± 0.7 ±78  
4 10 10 ± 0.087 ± 0.18 ±20  
5 12 13 ± 0.022 ± 0.022 ±2.4  
6 15 15 ± 0.0027 ± 0.0055 ±0.61  
7 17 18 ±0.00068 ±0.00068 ±0.076  
8 20 20 ±0.000086 ±0.000172 ±0.01911  
9 22 23 ±0.000021 ±0.000021 ±0.00478  
10 25 25 ±0.00000268 ±0.00000536 ±0.0005971  
11 27 28 ±0.00000067 ±0.00000067 ±0.0001492

"Because geohashes are just strings, they can be stored in an inverted index like any other string, which makes querying them very efficient."

could es use prefix tree storing geohash strings?

each size of a geohash strings represents a particular precision as given above.

then how to set the geohash\_precision to a distance value ?

```
1 only the distance value given above can be set to geohash_precision ?
2 a distance value which is not in given above will cause new index type 
which is different from geohashes inverted index?

```

my purpose is

```
1 use small index, which can be loaded to memory fast. and fully loaded one time one search
2 fast index search. 

```

so i think prefix tree is good enough.  
is there an option to set index to a prefix tree type.  
and i want to control the precision, geohash's precision is not exact enough.  
i want distance precision like : 600m, 2km, 5km, 10km which fit the map level.

or is there a option to create prefix tree custom.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 1, 2017, 3:51am UTC](https://discuss.elastic.co/t/how-to-set-geohash-precision-to-distance-value/95805/2 "2017-09-01T03:51:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
