# Does dropping geohash precision increase performance?

**URL:** <https://discuss.elastic.co/t/does-dropping-geohash-precision-increase-performance/9831>\
**Category:** Elasticsearch\
**Created:** [November 26, 2012, 10:21pm UTC](https://discuss.elastic.co/t/does-dropping-geohash-precision-increase-performance/9831 "2012-11-26T22:21:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Weitzenfeld](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel_weitzenfeld/32/2593_2.png) [@Daniel\_Weitzenfeld](https://discuss.elastic.co/u/Daniel_Weitzenfeld)\
**Post date:** [November 26, 2012, 10:21pm UTC](https://discuss.elastic.co/t/does-dropping-geohash-precision-increase-performance/9831/1 "2012-11-26T22:21:37Z")

</div>

For my application, I'm exploring the idea of penalizing documents based on  
their distance from a target point. Currently - using a different data  
store - we are using geo as a binary filter, ie, if a document is within a  
given radius of a target point, the document is considered, otherwise it is  
not.

To do this penalization, I'm using a custom\_filters\_score query, with this  
filter/script combo in the filters array:

{  
'filter': {  
'match\_all':{}  
},  
"script":"doc['geo'].distanceInKm(param13,  
param14)\*param15"  
}

[param13, param14] define the target point;  
param15 defines the strength of the penalty relative to the other penalties  
I'm applying.

On a small index I've created for testing, this is super fast, but I'm  
concerned about scale.  
My question:  
Precision is not important to me. If I switched to geohash (and  
geohashDistance) and dropped the geohash\_precision in the mapping for my  
geo field, would I gain anything, performance-wise? In other words, is the  
performance of geohashDistance a function of geohash\_precision?

--

---

<div class="post-metadata">

**Author:** ![Daniel\_Weitzenfeld](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel_weitzenfeld/32/2593_2.png) [@Daniel\_Weitzenfeld](https://discuss.elastic.co/u/Daniel_Weitzenfeld)\
**Post date:** [November 27, 2012, 7:30pm UTC](https://discuss.elastic.co/t/does-dropping-geohash-precision-increase-performance/9831/2 "2012-11-27T19:30:16Z")

</div>

Let me simplify this question some:

If I just want a set of documents that are roughly within a given radius of  
a given point, can I gain anything by using a low-precision geohash? Is  
there a tradeoff between geohash precision and performance?

On Monday, November 26, 2012 5:21:37 PM UTC-5, Daniel Weitzenfeld wrote:

> For my application, I'm exploring the idea of penalizing documents based  
> on their distance from a target point. Currently - using a different data  
> store - we are using geo as a binary filter, ie, if a document is within a  
> given radius of a target point, the document is considered, otherwise it is  
> not.
> 
> To do this penalization, I'm using a custom\_filters\_score query, with this  
> filter/script combo in the filters array:
> 
> {  
> 'filter': {  
> 'match\_all':{}  
> },  
> "script":"doc['geo'].distanceInKm(param13,  
> param14)\*param15"  
> }
> 
> [param13, param14] define the target point;  
> param15 defines the strength of the penalty relative to the other  
> penalties I'm applying.
> 
> On a small index I've created for testing, this is super fast, but I'm  
> concerned about scale.  
> My question:  
> Precision is not important to me. If I switched to geohash (and  
> geohashDistance) and dropped the geohash\_precision in the mapping for my  
> geo field, would I gain anything, performance-wise? In other words, is the  
> performance of geohashDistance a function of geohash\_precision?

--

---

<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:** [July 6, 2017, 3:02am UTC](https://discuss.elastic.co/t/does-dropping-geohash-precision-increase-performance/9831/3 "2017-07-06T03:02:36Z")

</div>


