ElasticSearch: Highlights every word in phrase query

后端 未结 1 775
天命终不由人
天命终不由人 2021-01-21 09:25

How can I get Elastic Search to only highlight words that caused the document to be returned?

I have the following index

{
  \"mappings\": {
    \"docume         


        
相关标签:
1条回答
  • 2021-01-21 09:40

    There is a highlighting bug in ES 2.1, which was caused due to this change. This has been fixed by this Pull Request.

    According to ES developer

    This is a bug that I introduced in #13239 while thinking that the differences were due to changes in Lucene: extractUnknownQuery is also called when span extraction already succeeded, so we should only fall back to Weight.extractTerms if no spans have been extracted yet.

    It works in older versions till 2.0 and would work as expected in future versions.

    0 讨论(0)
提交回复
热议问题