Hello there,
am I too dumb to read or does the highlight operator does not work with autocomplete?
Search Index:
{
"mappings": {
"dynamic": true,
"fields": {
"hashTags": [
{
"dynamic": true,
"type": "document"
},
{
"type": "string"
},
{
"tokenization": "nGram",
"type": "autocomplete"
}
]
},
"type": "document"
}
}
Now, for a dataset like this:
{
"uid": "xyz",
"hashTags": "abc, bca, kba"
}
I wanted to use the following search stage:
{
index: 'abc',
autocomplete: {
path: 'hashTags',
query: "smart",
fuzzy: {}
},
"highlight": {
"path": "hashTags",
"maxCharsToExamine": 1000,
"maxNumPassages": 5
}
}
and the $project stage:
{
_id: 0,
hashTags: '$hashTags',
highlights: {
"$meta": "searchHighlights"
}
}
BUT, somehow the answer is a empty highlight array. When I use the “text” operator, the highlighting works perfectly.
I could not find any advice in the docs, so I though I ask the community
Thanks in advice!