Highlight issue on field with custom analyzer

Hey guys,

We are having issues on fields with custom analyzer when using highlight feature. The field value is like "1kg", the customer analyzer will process and generate tokens including "1", "kg", "kilogram" as we also have synonym for "kg".

The mapping of the field is like below:

      "volumesize": {
            "type": "text",
            "fielddata": false,
            "analyzer": "analyzer_search",
            "term_vector": "with_positions_offsets",
            "index_options": "offsets"
      }

When we run below query with hightlight:

      "highlight": {
    "fields": {
      "displayname": {
        "type": "fvh"
      },
      "volumesize": {
        "type": "fvh"
      }
    }
  },
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "analyzer": "analyzer_search",
            "fields": [
              "volumesize",
              "productname",
            ],
            "query": "1kg coffee",
            "type": "cross_fields",
            "auto_generate_synonyms_phrase_query": "false"
          }
        }
      ]
    }
  }
  }
} 

The highlight on field "vollumesize" returns something like <em>1</em>k<em>g</em> which is not correct as the whole term "1kg" should be highlighted. we tried to use different highlighter like "unified", none of them works.

Can anyone please help?

Thanks a lot

Jason

does anyone have any idea please?

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