Elasticsearch | Highlight of integer fields when wildcard is used

I have indexed a document containing integers .

Mapping of these fields are :

"INTEGER_FIELD": {
  "type": "integer",
  "fields": {
	"keyword": {
	  "type": "keyword",
	  "ignore_above": 256
	}
  }
}

Search query is :

{
  "from": 0,
  "size": 10,
  "query": {
	"bool": {
	  "should": [
		{
		  "query_string": {
			"query": "\"0\"",
			"fields": [
			  "INTEGER_FIELD"
			],
			"boost": "2000"
		  }
		},
		{
		  "query_string": {
			"query": "*0*",
			"analyzer": "whitespace",
			"fields": [
			  "INTEGER_FIELD"
			]
		  }
		}
	  ],
	  "minimum_should_match": 1
	}
  },
  "highlight": {
	"type": "unified",
	"fields": {
	  "INTEGER_FIELD": {}
	}
  }
}

My doubts are:

1. When the above query is used, "INTEGER_FIELD" is highlighted,
The highlight result fetched is :

  "highlight": {
    "INTEGER_FIELD": [
      "<em>0</em>"
    ]
  }

2. When only the first query_string is used i.e.,

{
  "from": 0,
  "size": 10,
  "query": {
	"bool": {
	  "should": [
		{
		  "query_string": {
			"query": "\"0\"",
			"fields": [
			  "INTEGER_FIELD"
			],
			"boost": "2000"
		  }
		}
	  ],
	  "minimum_should_match": 1
	}
  },
  "highlight": {
	"type": "unified",
	"fields": {
	  "INTEGER_FIELD": {}
	}
  }
}

The document is retrieved/fetched but there is no highlighting present.

3. When only the second query_string is used i.e.,

{
  "from": 0,
  "size": 10,
  "query": {
	"bool": {
	  "should": [
		{
		  "query_string": {
			"query": "*0*",
			"analyzer": "whitespace",
			"fields": [
			  "INTEGER_FIELD"
			]
		  }
		}
	  ],
	  "minimum_should_match": 1
	}
  },
  "highlight": {
	"type": "unified",
	"fields": {
	  "INTEGER_FIELD": {}
	}
  }
}

The document is not fetched and hence nothing is highlighted

I am failing to understand the behaviour of highlighting here.
From what i understand, Elasticsearch provides highlight only for text fields. Why is Integer fields getting highlighted and Why is it getting highlighted only when I am using wildcard character?
Please let me know if I am going wrong somewhere

@elastic Please provide some information

@elastic I have waited a bit longer than expected
Please provide me a reply

May be provide a full recreation script as described in About the Elasticsearch category will give you more chance to get an answer? Please, try to keep the example as simple as possible.

I think I have provided complete script, starting from Mapping file to query and highlight result.

I can't just copy and paste your "script" and run it so I don't think you did.

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