我很难理解为什么以下查询对象不会使 ES 突出显示 _source 列中的所有单词。
{
_source: [
'baseline',
'cdrp',
'date',
'description',
'dev_status',
'element',
'event',
'id'
],
track_total_hits: true,
query: {
bool: {
filter: [],
should: [
{
multi_match:{
query: "imposed calcs",
fields: ["cdrp","description","narrative.*","title","cop"]
}
}
]
}
},
highlight: { fields: { '*': {} } },
sort: [],
from: 0,
size: 50
}
通过运行此查询,我得到以下高亮对象返回。请注意,仅突出显示“calcs”一词。如何构建突出显示对象以使 ES 突出显示“强加”?
"highlight": {
"description": [
"GAP Sub-window conn ONe-e: heve PP-BE Defined ASST requirem RV confsng, des MAN Imposed <em>calcs</em> mising"
]
}
我正在使用以下“描述”映射:
"description": {
"type": "text",
"analyzer": "search_synonyms"
},
"analysis": {
"analyzer": {
"search_synonyms": {
"tokenizer": "whitespace",
"filter": [
"graph_synonyms"
],
"normalizer": [
"normalizer_1"
]
}
},
"filter": {
"graph_synonyms": {
"type": "synonym_graph",
"synonyms_path": "synonym.txt"
}
},
"normalizer": {
"normalizer_1": {
"type": "custom",
"char_filter": [],
"filter": ["lowercase", "asciifolding"]
}
}
}