【发布时间】:2018-12-27 14:49:37
【问题描述】:
我有一个查询,它搜索词组、词级别和搜索词的模糊性。 有没有一种方法可以在匹配精确短语时限制单词和模糊匹配? 开发的查询是:
PUT test/_doc/1
{
"field1": "this is a test query - query",
"field2": "best rest vest pest"
}
GET test/_search
{
"query": {
"bool": {
"should": [
{
"multi_match": {
"query": "this is a test query",
"type": "phrase",
"slop": "2",
"fields": []
}
},
{
"multi_match": {
"query": "this is a test query",
"analyzer": "whitespace",
"fields": []
}
},
{
"multi_match": {
"query": "this is a test query",
"analyzer": "whitespace",
"fuzziness": "AUTO",
"fields": []
}
}
],
"minimum_should_match": 1
}
},
"highlight": {
"type": "unified",
"fields": {
"*": {}
}
}
}
得到的结果(只有Highlight)是:
"field1": [ "this is a test query - 查询" ], "field2": [ "best rest 背心 害虫" ]
我不希望在匹配“这是一个测试查询”短语时突出显示“best”、“rest”、“vest”和“pest”
【问题讨论】:
标签: elasticsearch