Hi, I use Elasticsearch 7.9.3, I configured 2 text fileds, one of them is for exact search.
Mapping:
"text_html": {
"type": "text",
"term_vector": "with_positions_offsets",
"store": true,
"analyzer": "text_minimal",
"search_analyzer": "search_text_minimal",
"fields": {
"exact": {
"type": "text",
"term_vector": "with_positions_offsets",
"analyzer": "text_exact"
}
}
}
When I run the query with query_string and with a proximity, no highlighting in the result list.
{
"highlight": {
"fields": {
"text": {
"number_of_fragments": 0,
"matched_fields": [
"text_html",
"text_html.exact"
],
"type": "fvh"
}
}
},
"_source": ["text_html"],
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "\"term1 term2 term3\"~10",
"fields": ["text_html"],
"default_operator": "and",
"auto_generate_synonyms_phrase_query": false
}
}
]
}
}
}
In the original document, theses terms are presented as:
term3 term1 term2
When I put term3 term1 term2 in the query, I get the highlighting with terms.
How to solve the hightlighting problem with fvh? Is it corrected in a newer version?
I find a similar question:
But in my case I should use fvh to highliter several fields in the same text.