Geo_polygon query in ES5.6 is slow?

Hello!

We are in the process of migrating our cluster from ES 1.5.2 to ES 5.6.2. We are running some performance tests on both of the clusters and it looks like geo_polygon query is slow in ES 5.6.2. Both have the same index settings, 5 shards and 1 replica:

ES1.5 results:
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.64s 544.52ms 4.82s 70.05%
Req/Sec 3.99 3.97 30.00 72.31%
Latency Distribution
50% 1.56s
75% 1.95s
90% 2.38s
99% 3.22s
25911 requests in 15.00m, 138.78MB read
Requests/sec: 28.79
Transfer/sec: 157.89KB

ES5.6 results:
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.71s 1.71s 10.49s 71.56%
Req/Sec 2.65 3.73 30.00 86.56%
Latency Distribution
50% 3.39s
75% 4.63s
90% 6.05s
99% 9.09s
11628 requests in 15.00m, 68.58MB read
Requests/sec: 12.92
Transfer/sec: 78.03KB

The performance script reads from a file that has the queries specific to its version:

ES1.5 query sample:
{
"size": 3000,
"filter": {
"geo_polygon": {
"property.location": {
"points": [
{
"lat": -33.91248,
"lon": 151.15363
},
{
"lat": -33.91248,
"lon": 151.19965
},
{
"lat": -33.94949,
"lon": 151.19965
},
{
"lat": -33.94949,
"lon": 151.15363
},
{
"lat": -33.91248,
"lon": 151.15363
}
]
}
}
},
"fields": [
"id",
"ota_hotel_code",
"provider_code"
]
}

ES5.6 query sample:
{
"size": 3000,
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_polygon": {
"location": {
"points": [
{
"lat": -33.91248,
"lon": 151.15363
},
{
"lat": -33.91248,
"lon": 151.19965
},
{
"lat": -33.94949,
"lon": 151.19965
},
{
"lat": -33.94949,
"lon": 151.15363
},
{
"lat": -33.91248,
"lon": 151.15363
}
]
}
}
}
}
},
"_source": {
"includes": [
"id",
"ota_hotel_code",
"provider_code"
]
}
}

We have tried rerunning the performance script a couple of times and ES1.5 has a much more consistent result of 23req/s whereas ES5.6 some times fluctuates between 12req/s to 23req/s.

We are not sure whether our query in 5.6 is correct or maybe we are missing some configuration.

Some thoughts here:

  • The query is not exactly the same. 1.5 uses a top level filter which should have been rewritten as a post_filter instead of a bool query with a filter clause.
  • Could you try by not setting the size parameter to see if it actually comes from the geo part or the fetch phase?

Thanks for your response!

I tried rerunning the query using constant score filter:

{
"size": 3000,
"query": {
"constant_score": {
"filter": {
"geo_polygon": {
"location": {
"points": [
{
"lat": -33.91248,
"lon": 151.15363
},
{
"lat": -33.91248,
"lon": 151.19965
},
{
"lat": -33.94949,
"lon": 151.19965
},
{
"lat": -33.94949,
"lon": 151.15363
},
{
"lat": -33.91248,
"lon": 151.15363
}
]
}
}
}
}
},
"_source": {
"includes": [
"id",
"ota_hotel_code",
"provider_code"
]
}
}

And the results was pretty much the same at around 13req/s.

I took your suggestion and removed the size param and that made the difference, it's way more faster at 160.19 req/s for ES5 and 151.23 req/s for ES1.5.

However, we need to specify a huge size for this query to get all the possible docs within the polygon.

I’m not sure if there is any optimization in this case.
I’m surprised that reading _source is super different between 1.x and 5.x though.

@jpountz do you have an idea?

Does it make a difference if you keep size:3000 but disable source filtering and always get the whole source?

1 Like

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