# Elasticsearch results doesn't highlight if a text is converted to raw datatype which is integer/double while searching

**URL:** <https://discuss.elastic.co/t/elasticsearch-results-doesnt-highlight-if-a-text-is-converted-to-raw-datatype-which-is-integer-double-while-searching/313632>\
**Category:** Kibana\
**Created:** [September 4, 2022, 8:38pm UTC](https://discuss.elastic.co/t/elasticsearch-results-doesnt-highlight-if-a-text-is-converted-to-raw-datatype-which-is-integer-double-while-searching/313632 "2022-09-04T20:38:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rathan\_K](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rathan_k/32/103495_2.png) [@Rathan\_K](https://discuss.elastic.co/u/Rathan_K)\
**Post date:** [September 4, 2022, 8:38pm UTC](https://discuss.elastic.co/t/elasticsearch-results-doesnt-highlight-if-a-text-is-converted-to-raw-datatype-which-is-integer-double-while-searching/313632/1 "2022-09-04T20:38:33Z")

</div>

Currently im using ES 7.10  
Creating a index and mapping

```auto
PUT /rathan_index
PUT /rathan_index/_mappings
{
    "properties" : {
		"Term__kt" : {
			"type" : "nested",
			"include_in_root" : true,
			"properties" : {
        
				"Fee_Amount" : {
					"type" : "text",
					"fields" : {
						"raw" : {
							"type" : "double"
							}
					}
				}
        
			}
		},
		"type" : {
			"type" : "keyword"
		}
	}
}

```

Insert some data

```auto
POST /rathan_index/_doc/contracts-74900
{
    "type": "contracts",
    "Term__kt" : [
			      {
              "Fee_Amount" : 105.75
            }
        ]
}

POST /rathan_index/_doc/contracts-74901
{
    "type": "contracts",
    "Term__kt" : [
			      {
              "Fee_Amount" : 105.75
            }
        ]
}

```

```auto
GET rathan_index/_search
{
  "from": 0,
  "size": 1000,
  "_source": [
    "*__kt.*"
  ],
  "track_total_hits": true,
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "filter": {
            "bool": {
              "must": [
                {
                  "term": {
                    "type": "contracts"
                  }
                }
              ]
            }
          },
          "should": [
            {
              "query_string": {
                "query": "0105.75",
                "type": "best_fields",
                "fields": [
                  "*__kt.*"
                ],
                "lenient": true,
                "default_operator": "AND",
                "boost": 3
              }
            },
            {
              "query_string": {
                "query": "0105.75",
                "type": "phrase_prefix",
                "fields": [
                  "*__kt.*"
                ],
                "lenient": true,
                "boost": 2
              }
            },
            {
              "query_string": {
                "query": "0105.75",
                "fields": [
                  "*__kt.*"
                ],
                "lenient": true,
                "type": "best_fields"
              }
            }
          ],
          "minimum_should_match": 1
        }
      }
    }
  },
  "min_score": 0.000001,
  "highlight": {
    "fields": {
      "*": {
        "type": "plain"
      }
    }
  }
}

```

The result comes with 105.75 but its not getting higlighted

```auto
{
  "took" : 565,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 2,
      "relation" : "eq"
    },
    "max_score" : 4.0,
    "hits" : [
      {
        "_index" : "rathan_index",
        "_type" : "_doc",
        "_id" : "contracts-74900",
        "_score" : 4.0,
        "_source" : {
          "Term__kt" : [
            {
              "Fee_Amount" : 105.75
            }
          ]
        },
        "highlight" : {
          "type" : [
            "<em>contracts</em>"
          ]
        }
      },
      {
        "_index" : "rathan_index",
        "_type" : "_doc",
        "_id" : "contracts-74901",
        "_score" : 4.0,
        "_source" : {
          "Term__kt" : [
            {
              "Fee_Amount" : 105.75
            }
          ]
        },
        "highlight" : {
          "type" : [
            "<em>contracts</em>"
          ]
        }
      }
    ]
  }
}

```

I'm assuming there is a implicit conversion that's happening which is converting 0105.75 to 105.75 .  
But i want it to highlighted regardless. Can i please get a solution for this.  
Thanks in advance

---

<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:** [October 2, 2022, 8:38pm UTC](https://discuss.elastic.co/t/elasticsearch-results-doesnt-highlight-if-a-text-is-converted-to-raw-datatype-which-is-integer-double-while-searching/313632/2 "2022-10-02T20:38:45Z")

</div>

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