Highlighting a numeric field from results fetched from custom "_all" fields

Hi,

I am new to Elasticsearch. We have certain data in different data-types that we want to index and retrieve. We are using custom "_all" fields as explained in the below link

Custom "_all" fields

Following is our code

PUT myindex
{
  "mappings": {
    "mytype": {
      "properties": {
        "first_name": {
          "type":    "text",
          "copy_to": "contact_details" 
        },
        "mobile_number": {
          "type":    "long",
          "copy_to": "contact_details" 
        },
        "contact_details": {
          "type":    "text"
        }
      }
    }
  }
}

PUT myindex/mytype/1
{
  "first_name": "John",
  "mobile_number": 9988776655
}

GET myindex/_search
{
  "query": {
    "multi_match": {
      "query": "9988776655",
      "fields": [
        "contact_details"
      ],
      "fuzziness": "auto"
    }
  },
  "highlight": {
    "require_field_match": false,
    "pre_tags": [
      "<tag1>"
    ],
    "post_tags": [
      "</tag1>"
    ],
    "fields": {
      "first_name": {},
      "mobile_number": {}
    }
  }
}

Using the above query we are able to fetch results but are not able to highlight the original field value as explained in the following link

Highlighting Original Fields

Need to know if we are doing anything wrong or is there a bug

Please note that we have to use the Custom "_all" field as it is important to our requirement. Also, the datatype of the fields cannot be changed.

Thanks a lot

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