# Named query performance degradation after upgrading to 8.13.2 (from 8.7.1)

**URL:** <https://discuss.elastic.co/t/named-query-performance-degradation-after-upgrading-to-8-13-2-from-8-7-1/359189>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [May 9, 2024, 1:17pm UTC](https://discuss.elastic.co/t/named-query-performance-degradation-after-upgrading-to-8-13-2-from-8-7-1/359189 "2024-05-09T13:17:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shimpeko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shimpeko/32/118252_2.png) [@shimpeko](https://discuss.elastic.co/u/shimpeko)\
**Post date:** [May 9, 2024, 1:17pm UTC](https://discuss.elastic.co/t/named-query-performance-degradation-after-upgrading-to-8-13-2-from-8-7-1/359189/1 "2024-05-09T13:17:13Z")

</div>

Hello,

After upgrading from 8.7.1 to 8.13.2, some of our queries are about 2x slower (longer response time). After digging, I've identified that the named query is causing the problem. Queries with "\_name" get about 2x slower, while the performance of queries without "\_name" stays the same.

We are running ES on K8S using ECK but it can be reproducible with docker environments. The same query takes longer in 8.13.2.

8.7.1:

```auto
--- 1st RUN ---
{
  "took" : 59,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}
--- 2nd RUN ---
{
  "took" : 13,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}
--- 3rd RUN ---
{
  "took" : 13,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}

```

8.13.2:

```auto
--- 1st RUN ---
{
  "took" : 296,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}
--- 2nd RUN ---
{
  "took" : 200,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}
--- 3rd RUN ---
{
  "took" : 201,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}

```

I've uploaded a reproducible set to my GitHub repos so that ES team can confirm it.

> **[GitHub - shimpeko/es\_named\_query\_perf](https://github.com/shimpeko/es_named_query_perf)**
>
> Contribute to shimpeko/es\_named\_query\_perf development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![shimpeko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shimpeko/32/118252_2.png) [@shimpeko](https://discuss.elastic.co/u/shimpeko)\
**Post date:** [May 13, 2024, 7:42am UTC](https://discuss.elastic.co/t/named-query-performance-degradation-after-upgrading-to-8-13-2-from-8-7-1/359189/2 "2024-05-13T07:42:39Z")

</div>

> [@shimpeko](#):
>
> 2x slower

Not 2x but more than 5x.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 13, 2024, 10:11am UTC](https://discuss.elastic.co/t/named-query-performance-degradation-after-upgrading-to-8-13-2-from-8-7-1/359189/3 "2024-05-13T10:11:27Z")

</div>

Thanks for the detailed script. I think you should open an issue in [GitHub - elastic/elasticsearch: Free and Open, Distributed, RESTful Search Engine](https://github.com/elastic/elasticsearch) with the same details you shared.

---

<div class="post-metadata">

**Author:** ![shimpeko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shimpeko/32/118252_2.png) [@shimpeko](https://discuss.elastic.co/u/shimpeko)\
**Post date:** [May 13, 2024, 11:17am UTC](https://discuss.elastic.co/t/named-query-performance-degradation-after-upgrading-to-8-13-2-from-8-7-1/359189/4 "2024-05-13T11:17:36Z")

</div>

> <https://github.com/elastic/elasticsearch/issues/108556>
>
> \### Elasticsearch Version
> 
> 8.13.2
> 
> \### Installed Plugins
> 
> \_No response\_
> 
> \### Jav…a Version
> 
> \_bundled\_
> 
> \### OS Version
> 
> official docker image
> 
> \### Problem Description
> 
> After upgrading from 8.7.1 to 8.13.2, some of our queries are more than 5x times slower (longer response time). After digging, I've identified that the named query is causing the problem. Queries with "\_name" get about 5x times slower, while the performance of queries without "\_name" stays the same.
> 
> We are running ES on K8S using ECK but it can be reproducible with docker environments. The same query takes longer in 8.13.2.
> 
> 8.7.1
> \`\`\`
> \--- 1st RUN ---
> {
> "took" : 59,
> "timed\_out" : false,
> "\_shards" : {
> "total" : 1,
> "successful" : 1,
> "skipped" : 0,
> "failed" : 0
> },
> "hits" : {
> "total" : {
> "value" : 0,
> "relation" : "eq"
> },
> "max\_score" : null,
> "hits" : \[\]
> }
> }
> \--- 2nd RUN ---
> {
> "took" : 13,
> "timed\_out" : false,
> "\_shards" : {
> "total" : 1,
> "successful" : 1,
> "skipped" : 0,
> "failed" : 0
> },
> "hits" : {
> "total" : {
> "value" : 0,
> "relation" : "eq"
> },
> "max\_score" : null,
> "hits" : \[\]
> }
> }
> \--- 3rd RUN ---
> {
> "took" : 13,
> "timed\_out" : false,
> "\_shards" : {
> "total" : 1,
> "successful" : 1,
> "skipped" : 0,
> "failed" : 0
> },
> "hits" : {
> "total" : {
> "value" : 0,
> "relation" : "eq"
> },
> "max\_score" : null,
> "hits" : \[\]
> }
> }
> \`\`\`
> 
> 8.13.2:
> \`\`\`
> \--- 1st RUN ---
> {
> "took" : 296,
> "timed\_out" : false,
> "\_shards" : {
> "total" : 1,
> "successful" : 1,
> "skipped" : 0,
> "failed" : 0
> },
> "hits" : {
> "total" : {
> "value" : 0,
> "relation" : "eq"
> },
> "max\_score" : null,
> "hits" : \[\]
> }
> }
> \--- 2nd RUN ---
> {
> "took" : 200,
> "timed\_out" : false,
> "\_shards" : {
> "total" : 1,
> "successful" : 1,
> "skipped" : 0,
> "failed" : 0
> },
> "hits" : {
> "total" : {
> "value" : 0,
> "relation" : "eq"
> },
> "max\_score" : null,
> "hits" : \[\]
> }
> }
> \--- 3rd RUN ---
> {
> "took" : 201,
> "timed\_out" : false,
> "\_shards" : {
> "total" : 1,
> "successful" : 1,
> "skipped" : 0,
> "failed" : 0
> },
> "hits" : {
> "total" : {
> "value" : 0,
> "relation" : "eq"
> },
> "max\_score" : null,
> "hits" : \[\]
> }
> }
> \`\`\`
> 
> \### Steps to Reproduce
> 
> Please see https://github.com/shimpeko/es\_named\_query\_perf/tree/main
> 
> \### Logs (if relevant)
> 
> \_No response\_

Thanks. I opened an issue.
