# Sort performance since elastic 7.16

**URL:** <https://discuss.elastic.co/t/sort-performance-since-elastic-7-16/315740>\
**Category:** Elasticsearch\
**Created:** [October 4, 2022, 6:51am UTC](https://discuss.elastic.co/t/sort-performance-since-elastic-7-16/315740 "2022-10-04T06:51:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vjgorla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vjgorla/32/95775_2.png) [@vjgorla](https://discuss.elastic.co/u/vjgorla)\
**Post date:** [October 4, 2022, 6:51am UTC](https://discuss.elastic.co/t/sort-performance-since-elastic-7-16/315740/1 "2022-10-04T06:51:43Z")

</div>

A query that sorts by a keyword field that we have been using on elastic 7.13.2 now performs quite badly on 8.4.1. There is no change to the query or mappings. Only change is the elastic version.

This query is crucial in our data pipeline and as a result we were forced to downgrade back to 7.13.2.

Here is the query

```auto
{
    "size": 100,
    "query": {
        "bool": {
            "filter": [{
                    "term": {
                        "parentId": {
                            "value": "xxxxxxx",
                            "boost": 1.0
                        }
                    }
                }, {
                    "term": {
                        "active": {
                            "value": true,
                            "boost": 1.0
                        }
                    }
                }
            ],
            "adjust_pure_negative": true,
            "boost": 1.0
        }
    },
    "sort": [{
            "id.keyword": {
                "order": "asc"
            }
        }
    ],
    "track_total_hits": 2147483647
}

```

_parentId_ and _id.keyword_ are of type keyword and _active_ is a boolean. Index has 9 shards and one replica in a 36 node cluster.

We use REST high level client (version 7.17.5) which generates the above query.

What could be the reason for performance degradation in elastic 8

Update: I tried all minor versions between 7.13.2 and 8.4.1 to pinpoint which version introduced this performance issue. It appears to be 7.16.0

---

<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:** [November 1, 2022, 6:52am UTC](https://discuss.elastic.co/t/sort-performance-since-elastic-7-16/315740/2 "2022-11-01T06:52:17Z")

</div>

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