【发布时间】:2020-02-14 17:15:23
【问题描述】:
我有一个 Elasticsearch 索引,当对搜索应用突出显示时,它会从字段中删除字符。
例子:
GET /myindex/_search
{
"query": {
"bool": {
"must": {
"multi_match": {
"query": "greene and associates",
"fuzziness" : "AUTO",
"fields": [
"name"
]
}
}
}
},
"highlight" : {
"fields" : {
"name" : {}
}
}
}
返回以下内容:
{
"_index" : "myindex",
...
"name" : "A. A. Greene & Associates",
...
},
"highlight" : {
"name" : [
"<em>Greene</em> & <em>Associates</em>"
]
}
}
我希望结果是
{
"_index" : "myindex",
...
"name" : "A. A. Greene & Associates",
...
},
"highlight" : {
"name" : [
"A. A. <em>Greene</em> & <em>Associates</em>"
]
}
}
我在这个查询中有什么问题?无论我尝试什么,我都无法获得“A. A.”。返回突出显示结果。
我们正在运行 v7.4,我已经搜索了其他有此问题的人,但尚未找到任何内容。
这是为索引定义字段的方式:
"name" : {
"type" : "text",
"boost" : 3.0,
"fields" : {
"raw" : {
"type" : "keyword"
},
"suggest" : {
"type" : "completion",
"analyzer" : "simple",
"preserve_separators" : true,
"preserve_position_increments" : true,
"max_input_length" : 50
}
}
}
【问题讨论】: