Highlight not working when adjacent entities

This happens when using mapper-annotated-text highlighter type:

eg Query:

{
    "query": {
        "ids": {
            "values": [
                "1"
            ]
        }
    },
    "_source": {
        "includes": [
            "test"
        ]
    },
    "highlight": {
        "type": "annotated",
        "highlight_query": {
            "query_string": {
                "query": "xxx",
                "fields": [
                    "test"
                ]
            }
        },
        "fields": {
            "test": {
                "number_of_fragments": 0,
                "no_match_size": 2147483647
            }
        }
    }
}

The response (when using highlight) skips the adjacent words, eg:

{
    "took": 1,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 1,
            "relation": "eq"
        },
        "max_score": 1.0,
        "hits": [
            {
                "_index": "test_index",
                "_type": "_doc",
                "_id": "1",
                "_score": 1.0,
                "_source": {
                    "test": "These are the english entities [reduce](_ent_bioverb_reduce)[increase](_ent_bioverb_increase)[treat](_ent_bioverb_treat)[affect](_ent_bioverb_affect)"
                },
                "highlight": {
                    "test": [
                        "These are the english entities [reduce](_ent_bioverb_reduce)increase[treat](_ent_bioverb_treat)affect"
                    ]
                }
            }
        ]
    }
}

Note that highlight skipped "increase" and "affect".
If I separate the words by adding whitespace before querying, it works. This issue only happens when there is no space between entities

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