# Track\_scores not working with suggestors and sort in v7.17.18

**URL:** https://discuss.elastic.co/t/track-scores-not-working-with-suggestors-and-sort-in-v7-17-18/354563
**Category:** Elasticsearch
**Created:** [March 2, 2024, 5:56am UTC](https://discuss.elastic.co/t/track-scores-not-working-with-suggestors-and-sort-in-v7-17-18/354563 "2024-03-02T05:56:39Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Nikhil\_Bansal1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikhil_bansal1/32/132278_2.png) [@Nikhil\_Bansal1](https://discuss.elastic.co/u/Nikhil_Bansal1)
#### Post date: [March 2, 2024, 5:56am UTC](https://discuss.elastic.co/t/track-scores-not-working-with-suggestors-and-sort-in-v7-17-18/354563/1 "2024-03-02T05:56:39Z")

</div>

I am upgrading Elasticsearch from v6 to v7. There is one query which is not working for me with track\_scores. Same query giving result in v6 but in v7 getting this error "Can't compute score on document as it doesn't match the query"  
I checked mapping everything is same. If i pass the same query without track\_scores i am getting result

```auto
curl --location 'http://localhost:9200/autosuggest/_search' \
--header 'Content-Type: application/json' \
--data '{
    "track_scores": true,
    "query": {
        "bool": {
            "should": [
                {
                    "match": {
                        "all_display_name_variations": {
                            "query": "benga",
                            "boost": 1
                        }
                    }
                },
                {
                    "match_phrase": {
                        "all_display_name_variations": {
                            "query": "benga",
                            "boost": 100
                        }
                    }
                }
            ]
        }
    },
    "sort": [
        {
            "_score": {
                "order": "desc"
            },
            "doc_weight": {
                "order": "desc"
            },
            "_id": {
                "order": "asc"
            }
        }
    ],
    "size": 10,
    "suggest": {
        "name_suggest": {
            "text": "benga",
            "completion": {
                "field": "name_suggest",
                "size": 10
            }
        },
        "fuzzy_suggest": {
            "text": "benga",
            "completion": {
                "field": "name_suggest",
                "size": 10,
                "fuzzy": {
                    "fuzziness": 1,
                    "min_length": 3,
                    "prefix_length": 1,
                    "transpositions": true
                }
            }
        }
    },
    "_source": [
        "id",
        "name",
        "district",
        "state",
        "is_enabled",
        "is_approved",
        "is_multi_district",
        "is_multi_state",
        "is_popular",
        "is_capital",
        "display_name",
        "doc_weight",
        "alias_type",
        "city_id",
        "city_name",
        "all_display_name_variations",
        "location",
        "language"
    ]
}'

```

---

<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: [March 2, 2024, 7:34am UTC](https://discuss.elastic.co/t/track-scores-not-working-with-suggestors-and-sort-in-v7-17-18/354563/2 "2024-03-02T07:34:30Z")

</div>

Welcome!

What is the full response from Elasticsearch?

---

<div class="post-metadata">

### Author: ![Nikhil\_Bansal1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikhil_bansal1/32/132278_2.png) [@Nikhil\_Bansal1](https://discuss.elastic.co/u/Nikhil_Bansal1)
#### Post date: [March 2, 2024, 7:46am UTC](https://discuss.elastic.co/t/track-scores-not-working-with-suggestors-and-sort-in-v7-17-18/354563/3 "2024-03-02T07:46:00Z")

</div>

Response of above query

```auto
{
            "error":
            {
                "root_cause":
                [
                    {
                        "type": "illegal_state_exception",
                        "reason": "Can't compute score on document as it doesn't match the query"
                    }
                ],
                "type": "search_phase_execution_exception",
                "reason": "all shards failed",
                "phase": "fetch",
                "grouped": true,
                "failed_shards":
                [
                    {
                        "shard": 0,
                        "index": "autosuggest--2024-02-28--21-04-35",
                        "node": "dxjnynMMR4iJYBcxUc9FIg",
                        "reason":
                        {
                            "type": "illegal_state_exception",
                            "reason": "Can't compute score on document as it doesn't match the query"
                        }
                    }
                ],
                "caused_by":
                {
                    "type": "illegal_state_exception",
                    "reason": "Can't compute score on document as it doesn't match the query",
                    "caused_by":
                    {
                        "type": "illegal_state_exception",
                        "reason": "Can't compute score on document as it doesn't match the query"
                    }
                }
            },
            "status": 500
        }

```

---

<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: [March 2, 2024, 8:51am UTC](https://discuss.elastic.co/t/track-scores-not-working-with-suggestors-and-sort-in-v7-17-18/354563/4 "2024-03-02T08:51:10Z")

</div>

It looks like a bug to me.  
Could you reproduce it with a minimalist script and test it on latest 8.x?

---

<div class="post-metadata">

### Author: ![Nikhil\_Bansal1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikhil_bansal1/32/132278_2.png) [@Nikhil\_Bansal1](https://discuss.elastic.co/u/Nikhil_Bansal1)
#### Post date: [March 2, 2024, 9:14am UTC](https://discuss.elastic.co/t/track-scores-not-working-with-suggestors-and-sort-in-v7-17-18/354563/5 "2024-03-02T09:14:32Z")

</div>

Just have more small query, if i remove track\_scores will this give same result because i am using \_score field in sort?

---

<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: [March 2, 2024, 1:25pm UTC](https://discuss.elastic.co/t/track-scores-not-working-with-suggestors-and-sort-in-v7-17-18/354563/6 "2024-03-02T13:25:35Z")

</div>

I don't know.

---

<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: [March 30, 2024, 1:26pm UTC](https://discuss.elastic.co/t/track-scores-not-working-with-suggestors-and-sort-in-v7-17-18/354563/7 "2024-03-30T13:26:12Z")

</div>

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