Elastic Search Interaction of Highlights with Synonym Filter Elastic Search Interaction of Highlights with Synonym Filter elasticsearch elasticsearch

Elastic Search Interaction of Highlights with Synonym Filter


@SergeyS the situation both you and @user2430530 has is perfectly described in this section of the documentation.

And the suggestion there is to try and define a single term for each serie of synonyms not to get back that mix up of terms highlighted in the result.

Something like this:

"analysis": {  "analyzer": {    "synonym": {      "tokenizer": "whitespace",      "filter": [        "synonym"      ]    }  },  "filter": {    "synonym": {      "type": "synonym",      "synonyms": [        "dawdle, waste time=>waste_time"      ]    }  }}

Then you'll get the desired result from ES:

        "highlight": {           "text": [              "some <em>dawdle</em> company"           ]        }