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


(Shugang Kang) #1

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


(system) #2