Geo Bounding Box/Polygon Queries getting slow in ES 6.2 than ES 2.3

Hi,
I am doing a migration from Elasticsearch 2.3 to elasticesearch 6.2. The index migration was done successfully but i am facing a performance issue after the migration in Bounding box/polygon queries when used with terms query.
Bellow are my findings:

Elasticsearch instance Info:
{
"capture_index_2" : {
"settings" : {
"index" : {
"number_of_shards" : "5",
"blocks" : {
"write" : "false"
},
"provided_name" : "capture_index_2",
"max_result_window" : "50000",
"creation_date" : "1526027809998",
"number_of_replicas" : "1",
"uuid" : "Rlj8kwCoTReI6vfhjH9YeQ",
"version" : {
"created" : "6020299"
}
}
}
}
}

Document Count : 240445029
Size in bytes : 53.59 GB

My Query :
{
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"geo_bounding_box": {
"alignedlocation": {
"bottom_left": {
"lat": 32.77086742341999,
"lon": -96.79832736358046
},
"top_right": {
"lat": 32.7731293740476,
"lon": -96.77691577468067
}
}
}
},
{
"terms": {
"vehicleType": [
0,
1
]
}
},
{
"terms": {
"dataformat": [
0,
1
]
}
}
],
"should": [
{
"range": {
"expirationdate": {
"gt": "1526668200000"
}
}
},
{
"range": {
"datatypes": {
"gte": "0",
"lt": "2"
}
}
},
{
"range": {
"datatypes": {
"gt": "4"
}
}
}
],
"minimum_should_match": 1
}
}
]
}
},
"from": 0,
"size": 1000,
"sort": [
{
"starttime": {
"order": "desc"
}
},
{
"uuid": {
"order": "desc"
}
},
{
"eventid": {
"order": "asc"
}
}
]
}

and in ES 2.3 this query takes 39 ms where in ES 6.2 it takes 370 ms and one interesting fact is if i remove the termsQueries from the ES 6.2 query the time reduce to 22 ms.

Requesting for assistance.

If you run the same query (minus the removal of there termsQuery) with "profile": true, we can see the breakdown of such.

ref: https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-profile.html#_usage_3

Hi @JKhondhu,

Sorry for the late reply.. I ran the queries with "profile": true, and i attached the files bellow

  1. ES-6.2-with-terms query
  2. ES-6.2-without-term-query
  3. ES-2.3

Please let me know if anything else required.

So i fix my Problem.
Actually the fields on which terms queries were perform are actually of type integer .
So according to the Elasticsearch 6.2 documentation numeric fields are optimized for range queries not for term queries. So converting the fields to keyword type solve my performance issue.
I believe in case of Elastic search 2.3 this is not the case.

1 Like

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