Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): Opensearch version 3.2.0
Describe the issue: Lexical highlight not returned for hybrid query
I have a knn index and I want to use a hybrid query while still keeping track of the lexical matches but Opensearch seems to ignore the highlight parameter.
Here is an example of the query structure:
GET my_index/_search?search_pipeline=hybrid_search_pipeline
{
"_source": {
"excludes": [
"chunk_embedding"
]
},
"collapse": {
"field": "id"
},
"highlight": {
"fragment_size": 100,
"post_tags": [
"</span>"
],
"pre_tags": [
"""<span solrfound="true" style="background:#fdfdb0;">"""
],
"fields": {
"description": {},
"altDescription": {}
}
},
"query": {
"hybrid": {
"queries": [
{
"query_string": {
"fields": [
"description^2.0",
"altDescription^1.5",
"attachmentData"
],
"query": "rossini~1"
}
},
{
"neural": {
"chunk_embedding": {
"query_text": "rossini"
}
}
}
]
}
},
"size": 50
}
The search does not fail and the results are returned but there is no “highlight” element.
Searching similar topics I found some discussing semantic highlighting but that is NOT my need for now. I only need to obtain the lexical matches with highlight.
I also tried adding the “highlight_query” parameter but it did not solve the issue.
Configuration: Knn index. Both fields I am trying to use highlighting on have the mapping:
{
"store": true,
"term_vector": "yes",
"type": "text"
}
Can anyone help me?