# Getting Hash value in sort response, ES json response is invalid

**URL:** <https://discuss.elastic.co/t/getting-hash-value-in-sort-response-es-json-response-is-invalid/260346>\
**Category:** Elasticsearch\
**Created:** [January 6, 2021, 1:20pm UTC](https://discuss.elastic.co/t/getting-hash-value-in-sort-response-es-json-response-is-invalid/260346 "2021-01-06T13:20:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sravanti](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@Sravanti](https://discuss.elastic.co/u/Sravanti)\
**Post date:** [January 6, 2021, 1:20pm UTC](https://discuss.elastic.co/t/getting-hash-value-in-sort-response-es-json-response-is-invalid/260346/1 "2021-01-06T13:20:08Z")

</div>

I'm using icu\_collation for phonebook sort, but getting a hash value in sort response in below search query

```auto
GET testindex1/_search
{
  "sort": [
    {
      "id.sort_en": {
        "order": "ASC",
        "unmapped_type": "string"
      }
    }
  ]
}

```

```auto
"sort": [
          """ถ䵄䊃懥㢲Єᰃ䗜湡㜱㮀"""
        ]

```

But when i'm using **keyword** instead of **sort\_en** , proper string value is showing up in sort response.  
Due to this there are additional quotes are generated, and my json parsing is failing stating invalid json. Is there any other way to no show hash value, or convert to string format.

Below are the template, document, which i have used

```auto
{
  "settings": {
    "analysis": {
      "filter": {
        "ngram_filter": {
          "type": "ngram",
          "min_gram": 1,
          "max_gram": 500
        }
      },
      "analyzer": {
        "index_analyzer": {
          "tokenizer": "whitespace",
          "filter": [
            "ngram_filter",
            "lowercase"
          ]
        },
        "search_analyzer": {
          "type": "custom",
          "tokenizer": "whitespace",
          "filter": "lowercase"
        }
      }
    }
  },
  "mappings": {
    "doc": {
      "properties": {
        "id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            },
            "sort_en": {
              "type": "icu_collation_keyword",
              "index": true,
              "language": "en",
              "country": "US",
              "variant": "@collation=phonebook"
            }
          },
          "analyzer": "index_analyzer",
          "search_analyzer": "search_analyzer"
        }
      }
    }  
  }      
}

```

```auto
POST testindex1/doc/1
{
  "id": "5CG0166X2M"
}

```

Any help would be appreciated.

---

<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:** [February 3, 2021, 1:20pm UTC](https://discuss.elastic.co/t/getting-hash-value-in-sort-response-es-json-response-is-invalid/260346/2 "2021-02-03T13:20:30Z")

</div>

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