# Geo distance performance varies greatly for different \[lat, lon\] values

**URL:** <https://discuss.elastic.co/t/geo-distance-performance-varies-greatly-for-different-lat-lon-values/8146>\
**Category:** Elasticsearch\
**Created:** [June 18, 2012, 5:17pm UTC](https://discuss.elastic.co/t/geo-distance-performance-varies-greatly-for-different-lat-lon-values/8146 "2012-06-18T17:17:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shugang\_Kang](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Shugang\_Kang](https://discuss.elastic.co/u/Shugang_Kang)\
**Post date:** [June 18, 2012, 5:17pm UTC](https://discuss.elastic.co/t/geo-distance-performance-varies-greatly-for-different-lat-lon-values/8146/1 "2012-06-18T17:17:53Z")

</div>

I am using the geo distance filter in the query. The performance  
varies a lot for different lat, lon values.

TEST:

Here is the geo distance filter that I am using:

'filter': {  
'geo\_distance': {  
'distance': '15mi',  
'distance\_type': 'plane',  
'optimize\_bbox': 'indexed',  
'location.geo\_pos': [lat, lon]}  
}  
}

I created a simple program to use different [lat, lon] values in the  
query. I use a loop to try different lat, lon values, for each round  
of the loop, I call a elasticsearch with a query. Everything is the  
same for the query, and I only change the [lat, lon] values.

RESULT:

For most lat, lon values, there is not hits (hits=0), the search  
respond time is less than 0.1 second. However, for some lat, lon  
values, the search respond time is many times (\>200) longer, for  
example, here are a few selected lat, lon values that lead to very  
long search time:

lat=25 lon=-115 hits=0 respond time \> 25s  
lat=25 lon=-116 hits=0 respond time \> 21s  
lat=25 lon=-120 hits=0 respond time \> 23s

Run the test program multiple times, the the slow lat, lon values  
keeps slow consistently.

Is there any reason can explain this? And how can I solve this  
problem?

Thank you very much for your kind help!

Shugang

---

<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:23am UTC](https://discuss.elastic.co/t/geo-distance-performance-varies-greatly-for-different-lat-lon-values/8146/2 "2017-07-06T03:23:34Z")

</div>


