# ElasticSearch V0.90 Faster Than V7.10.1

**URL:** <https://discuss.elastic.co/t/elasticsearch-v0-90-faster-than-v7-10-1/267495>\
**Category:** Elasticsearch\
**Created:** [March 17, 2021, 12:02pm UTC](https://discuss.elastic.co/t/elasticsearch-v0-90-faster-than-v7-10-1/267495 "2021-03-17T12:02:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ercinakcay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ercinakcay/32/84890_2.png) [@ercinakcay](https://discuss.elastic.co/u/ercinakcay)\
**Post date:** [March 17, 2021, 12:02pm UTC](https://discuss.elastic.co/t/elasticsearch-v0-90-faster-than-v7-10-1/267495/1 "2021-03-17T12:02:29Z")

</div>

Hi everyone,

We are doing migration for ElasticSearch version **0.90** to version **7.10.1**. I know this is really big upgrade for a component.

While this migration we realized, V7 queries are slower than V0 ones.

This slow performance can be observed at version 7 even for simple queries.

Simple query that performs better at V0:

- v0 query:

- v7 query:

- some\_term\_value is mapped as `long`.

Machine specs;

- Both: 64GB machine RAM, 24GB ElasticSearch JVM RAM
- Both: has same CPU type and SSD disks.
- Both: standalone machines.
- Both: using JDK in the machine.
  - V0: 1.8.0\_232
  - V7: 11.0.5

JVM options;

```auto
## JVM configuration

-Djava.io.tmpdir=...

-Xms24g
-Xmx24g

-Djava.net.preferIPv4Stack=true

## G1GC Configuration
11-:-XX:+UseG1GC
11-:-XX:G1ReservePercent=25
11-:-XX:InitiatingHeapOccupancyPercent=30

# use old-style file permissions on JDK9
-Djdk.io.permissionsUseCanonicalPath=true

## GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m

```

ElasticSearch Specs:

- v7 using G1GC for garbage collection.
  - Before this option we tried concurrent-mark-sweep but g1gc was way better for performance and cpu usage.

- request\_caching is disable. Cause of unnecessary option for our data actuality.
  - Our index is updated regulary by bulk inserts/deletes with interval of 500ms. This options is same for v0 and v7.

- 900+ mapping property.

In our environment setups these queries;  
- took for v0 `~20ms - ~30ms`  
- took for v7 `~40ms - ~50ms`

Our most consuming queries as sample:

- v0 query:

- v7 query:

My main question here, with these huge version change of the ElasticSearch that range of V7 and V0, why version 7 slower than version 0 ?

If that's the case, do you have any suggestion for improving our query performance?

Or we are doing some dirt in our setup.

Thanks for advice!  
Have a Nice Day.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 17, 2021, 12:10pm UTC](https://discuss.elastic.co/t/elasticsearch-v0-90-faster-than-v7-10-1/267495/2 "2021-03-17T12:10:03Z")

</div>

Longs, ints etc are assumed to be _quantities_ - things you query in ranges e.g. pages with \> 1m likes. The data structures used are optimised for range queries.

If your numbers are unique IDs which you query individually e.g. find productID = 7823672 then `keyword` fields are a better choice. That said, the performance differences between longs and keyword fields for ID queries don't tend to be noticeable until you're packing many ID queries into a single request.

---

<div class="post-metadata">

**Author:** ![ercinakcay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ercinakcay/32/84890_2.png) [@ercinakcay](https://discuss.elastic.co/u/ercinakcay)\
**Post date:** [March 17, 2021, 12:27pm UTC](https://discuss.elastic.co/t/elasticsearch-v0-90-faster-than-v7-10-1/267495/4 "2021-03-17T12:27:11Z")

</div>

Hi Mark,

Thanks for the quick reply.

We will absolutely try your suggestion on our long fields but our main question was about the time difference between v0 and v7 requests.

Also in V0 field mapping is long for that value.

Do you have any idea about why v7 would respond slower than v0 under _mostly_ same circumstances?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 17, 2021, 1:17pm UTC](https://discuss.elastic.co/t/elasticsearch-v0-90-faster-than-v7-10-1/267495/5 "2021-03-17T13:17:20Z")

</div>

> [@ercinakcay](#):
>
> under _mostly_ same circumstances?

So much has changed in both Lucene and elasticsearch between those versions it would be hard to pinpoint any single factor. Generally changes in performance are tracked by [nightly benchmarks](https://elasticsearch-benchmarks.elastic.co/) which have been running for a number of years and have helped trap several unexpected regressions.  
Also, we now have query profiler which you can use to help spot where time is going.

---

<div class="post-metadata">

**Author:** ![ercinakcay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ercinakcay/32/84890_2.png) [@ercinakcay](https://discuss.elastic.co/u/ercinakcay)\
**Post date:** [March 18, 2021, 6:41pm UTC](https://discuss.elastic.co/t/elasticsearch-v0-90-faster-than-v7-10-1/267495/6 "2021-03-18T18:41:42Z")

</div>

I changed the mapping for `keywords` for proper values. Still version 0 performing better than version 7. Almost nothing changed at the query evaluation.

Only version 7 queries can be profiled sadly. For that reason, it is like comparing apples to oranges. If you can suggest any other method, i would lovely hear it.

Could you spot any anomaly at sample queries structures which i did post ?  
After that all version upgrade many functions changed and of course adapted for new version.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 18, 2021, 7:04pm UTC](https://discuss.elastic.co/t/elasticsearch-v0-90-faster-than-v7-10-1/267495/7 "2021-03-18T19:04:56Z")

</div>

> [@ercinakcay](#):
>
> Could you spot any anomaly at sample queries structures which i did post ?

V0 had no aggs?  
Honestly you’d need to distill it down to a full JSON example and ideally minimised to the simplest request that shows clear differences.

---

<div class="post-metadata">

**Author:** ![ercinakcay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ercinakcay/32/84890_2.png) [@ercinakcay](https://discuss.elastic.co/u/ercinakcay)\
**Post date:** [March 18, 2021, 8:10pm UTC](https://discuss.elastic.co/t/elasticsearch-v0-90-faster-than-v7-10-1/267495/8 "2021-03-18T20:10:25Z")

</div>

V0 has aggregation as well. Sorry for misleading about that.  
Here it is the queries which i am using.

- v0

```json
{
  "from": "0",
  "size": "15",
  "fields": ["id", "labels"],
  "query": {
    "filtered": {
      "query": {
        "match_all": {}
      },
      "filter": {
        "and": [{
            "terms": {
              "t1": [
                "12345"
              ]
            }
          },
          {
            "or": [{
                "term": {
                  "t2": "12345"
                }
              },
              {
                "term": {
                  "t3": "45677"
                }
              }
            ]
          },
          {
            "range": {
              "t4": {
                "from": 1600000000,
                "include_lower": true,
                "to": 2000000000,
                "include_upper": true
              }
            }
          }
        ]
      }
    }
  },
  "filter": {
    "and": [{
        "range": {
          "g1": {
            "from": 0,
            "include_lower": true,
            "to": 10,
            "include_upper": true
          }
        }
      },
      {
        "terms": {
          "g2": [
            "a",
            "b",
            "c"
          ]
        }
      }
    ]
  },
  "facets": {
    "facet_1": {
      "terms": {
        "field": "g3",
        "size": "99"
      },
      "facet_filter": {
        "and": [{
            "range": {
              "g1": {
                "from": 0,
                "include_lower": true,
                "to": 10,
                "include_upper": true
              }
            }
          },
          {
            "terms": {
              "g2": [
                "a",
                "b",
                "c"
              ]
            }
          }
        ]
      }
    },
    "facet_2": {
      "terms": {
        "field": "g4",
        "size": "5"
      },
      "facet_filter": {
        "and": [{
            "range": {
              "g1": {
                "from": 0,
                "include_lower": true,
                "to": 10,
                "include_upper": true
              }
            }
          },
          {
            "terms": {
              "g2": [
                "a",
                "b",
                "c"
              ]
            }
          }
        ]
      }
    },
    "facet_3": {
      "terms": {
        "field": "g5",
        "size": "99"
      },
      "facet_filter": {
        "and": [{
          "range": {
            "f3": {
              "from": 0,
              "include_lower": true,
              "to": 5,
              "include_upper": true
            }
          }
        }]
      }
    }

  },
  "sort": [{
      "s1": "desc"
    },
    {
      "s2": "desc"
    }
  ]
}

```

- v7

```json
{
    "track_total_hits": true,
    "from": "0",
    "size": "15",
    "_source": ["id", "labels"],
    "query": {
        "bool": {
            "must": [{
                "match_all": {}
            }],
            "filter": [{
                    "terms": {
                        "t1": [
                            "12345"
                        ]
                    }
                },
                {
                    "bool": {
                        "should": [{
                            "bool": {
                                "should": [{
                                        "term": {
                                            "t2": "12345"
                                        }
                                    },
                                    {
                                        "term": {
                                            "t3": "45677"
                                        }
                                    }
                                ]
                            }
                        }]
                    }
                },
                {
                    "range": {
                        "t4": {
                            "from": 1600000000,
                            "include_lower": true,
                            "to": 2000000000,
                            "include_upper": true
                        }
                    }
                }

            ]
        }
    },
    "aggs": {
        "aggs_1": {
            "filter": {
                "bool": {
                    "must": [{
                            "range": {
                                "g1": {
                                    "from": 0,
                                    "include_lower": true,
                                    "to": 10,
                                    "include_upper": true
                                }
                            }
                        },
                        {
                            "terms": {
                                "g2": [
                                    "a",
                                    "b",
                                    "c"
                                ]
                            }
                        }
                    ]
                }
            },
            "aggs": {
                "facet_1": {
                    "meta": {
                        "type": "terms"
                    },
                    "terms": {
                        "field": "g3",
                        "size": "99",
                        "order": [{
                            "_count": "desc"
                        }, {
                            "_key": "desc"
                        }]
                    }
                },
                "facet_2": {
                    "meta": {
                        "type": "terms"
                    },
                    "terms": {
                        "field": "g4",
                        "size": "5",
                        "order": [{
                            "_count": "desc"
                        }, {
                            "_key": "desc"
                        }]
                    }
                }
            }
        },
        "facet_3": {
            "meta": {
                "type": "terms"
            },
            "filter": {
                "bool": {
                    "must": [{
                        "range": {
                            "f3": {
                                "from": 0,
                                "include_lower": true,
                                "to": 5,
                                "include_upper": true
                            }
                        }
                    }]
                }
            },
            "aggs": {
                "_filtered_sub_aggs": {
                    "meta": {
                        "type": "terms"
                    },
                    "terms": {
                        "field": "g5",
                        "size": "99",
                        "order": [{
                            "_count": "desc"
                        }, {
                            "_key": "desc"
                        }]
                    }
                }
            }
        }
    },
    "post_filter": {
        "bool": {
            "must": [{
                    "range": {
                        "g1": {
                            "from": 0,
                            "include_lower": true,
                            "to": 10,
                            "include_upper": true
                        }
                    }
                },
                {
                    "terms": {
                        "g2": [
                            "a",
                            "b",
                            "c"
                        ]
                    }
                }
            ]
        }
    },
    "sort": [{
            "s1": "desc"
        },
        {
            "s2": "desc"
        }
    ]
}

```

The most interesting part at these queries;

- Both queries processed same action as removing sorting, still v0 faster.
- Both queries processed same action as removing aggregations, still v0 faster.

---

<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:** [April 15, 2021, 8:10pm UTC](https://discuss.elastic.co/t/elasticsearch-v0-90-faster-than-v7-10-1/267495/9 "2021-04-15T20:10:37Z")

</div>

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