Elasticsearch query search sort return null

I'm recently upgrade elasticsearch to 7.9.3 version. All are good but sort not working in one of my index called user_products.

searched query
curl -X GET "localhost:9200/user_products/_search?pretty" -H 'Content-Type: application/json' -d'
{
"sort" : [
{ "3_raw" : {"order" : "desc"}},
"_score"
],
"query" : {
"match" : { "summary.3" : "REF" }
}
}
'
My index mapping
Please see the below link to check my mapping
https://www.codepile.net/pile/D72zJV75

Any help is highly appreciated. Thanks

Welcome!

Please don't post images of text as they are hard to read, may not display correctly for everyone, and are not searchable.

Instead, paste the text and format it with </> icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

It would be great if you could update your post to solve this.

It's always better to share a full simple script which reproduces your problem.
Here I tried this:

DELETE test 
PUT test
{
  "mappings": {
    "properties": {
      "3": {
        "type": "text",
        "fielddata": true
      },
      "3_raw": {
        "type": "keyword"
      }
    }
  }
}
POST test/_doc
{
  "3": "REF",
  "3_raw": "REF"
}
POST test/_doc
{
  "3": "FOO",
  "3_raw": "FOO"
}
GET test/_search
{
  "sort": [
    {
      "3_raw": {
        "order": "desc"
      }
    },
    "_score"
  ],
  "query": {
    "match": {
      "3": "REF"
    }
  }
}

And this gives me the expected result:

{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [
      {
        "_index" : "test",
        "_type" : "_doc",
        "_id" : "xsQo5nUBfcFQk7m1LfKv",
        "_score" : 0.6931471,
        "_source" : {
          "3" : "REF",
          "3_raw" : "REF"
        },
        "sort" : [
          "REF",
          0.6931471
        ]
      }
    ]
  }
}

Tested on 7.9.3.

Could you provide a full recreation script as above. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

Hi @dadoonet,

Thanks for you help in the section. your code done a magic. once again thanks man

Could you tell what was the problem?