Open Viggon opened 7 months ago
Pinging @elastic/es-search (Team:Search)
Sorry, the above DSL with function_score is wrong, actually it is:
GET my_index/_search { "query": { "function_score": { "query": { "match_phrase": { "name": { "query": "互联", "slop": 0, "zero_terms_query": "NONE", "boost": 1 } } } } }, "highlight": { "fields": { "name": { "pre_tags": [ "<span class=\"lawRed\" >" ], "post_tags": [ "</span>" ] } } } }
Pinging @elastic/es-search-relevance (Team:Search Relevance)
Elasticsearch Version
7.8
Installed Plugins
No response
Java Version
jdk1.8
OS Version
win10
Problem Description
Two queries that are basically the same (the only difference is that function_score is used in one of them) return different highlighting effects
Steps to Reproduce
create index:
put my_index
add data:POST my_index/_doc { "name":"互联互通技术" }
DSL with function_score:GET my_index/_search { "query": { "function_score": { "query": { "match_phrase": { "name": { "query": "互联", "slop": 0, "zero_terms_query": "NONE", "boost": 1 } } } } }, "highlight": { "fields": { "name": { "pre_tags": [ "<span class=\"lawRed\" >" ], "post_tags": [ "</span>" ], "highlight_query": { "match_phrase": { "name": { "query": "互联", "slop": 0, "zero_terms_query": "NONE", "boost": 1 } } } } } } }
DSL without function_score:GET my_index/_search { "query": { "match_phrase": { "name": { "query": "互联", "slop": 0, "zero_terms_query": "NONE", "boost": 1 } } }, "highlight": { "fields": { "name": { "pre_tags": [ "<span class=\"lawRed\" >" ], "post_tags": [ "</span>" ], "type":"plain" } } } }
The highlighting results for the above two statements are different:Logs (if relevant)
No response