*Reducing* geoshape tree_levels doubles query time (1.7)

(Richard Baker) #1

Hi There,

This is a first post, so please bear with me!

I'm running a 3 replica cluster with client node on ES 1.7 on 8 core/60Gb machines. I have an index containing various analysed fields and a nested geoshape. The stored geoshapes are generally "circles" of up to 400000 metres (~250 miles) radius.

Previously the index was mapped with the default geoshape precision/tree_levels setting (50 metres) which I believe equates to a tree_levels value of 12.

The index contains nearly 4 million documents (roughly 48 million due to nesting) and memory usage was around 30Gb.

Performance was good, average query between 100 - 200ms, but I was looking to reduce the memory usage.

I reindexed the data into another index with the mapping geoshape precision value of 500m (equating to tree_levels 7). The data is identical, but query times are now double at 400 - 900 ms. Memory usage of this index has halved however!

I would have thought a lower tree_levels value would have improved query times as there are fewer geohash terms in the prefix tree. The "performance considerations" section in the documentation cautions the use of high tree_levels values, however i'm seeing quite a degradation in query performance with lower values.

I can't find any similar issues by searching. Any experience or wisdom would be greatly appreciated.

Thanks in advance.

(Nick Knize) #2

Hi @Richard_Baker

Can you post the geo_shape mapping and an example query that's causing the issue?

(Richard Baker) #3

Thanks @nknzine

Here's the mapping: https://gist.github.com/rjbaker/7752003e7d4990618dd2#file-users-1-2-json-L67-L68

An example query looks like this: https://gist.github.com/rjbaker/9a9666d17ac9a55ac5b7

This has been running in production quite happily and with acceptable performance for quite some time using the default geoshape precision.

I was attempting to reduce memory usage by reducing the precision setting/tree_levels. This has worked but this query is now unacceptably slow. Data was reindexed on the same cluster.

Many thanks.

(Richard Baker) #4

Further to this, I have increased tree_levels to 10. This has increased memory usage by ~6GB but improved query speed considerably.

Everything I have read seems to imply that a lower tree levels value will improve query speed and reduce memory usage, at the expense of geospatial search accuracy. However, in practice I have found the opposite.

(system) #5