[英]Fuzziness behavior on a match_phrase query
几天前,我遇到了这个“问题”。 我在索引中运行match_phrase
查询。 一切都按预期进行,直到我对多个单词名词进行了相同的搜索(在我使用单个单词名词之前,例如:大学)。 我拼错了一个单词,但搜索没有成功(找不到),如果我删除了一个单词(假设拼写正确的单词),搜索工作(找到了)。
这里有我做的例子:
设定
PUT index1
{
"mappings": {
"myType": {
"properties": {
"field1": {
"type": "string",
"analyzer": "standard"
}
}
}
}
}
POST index1/myType/1
{
"field1": "Commercial Banks"
}
情况1:单名词搜索
GET index1/myType/_search
{
"query": {
"match": {
"field1": {
"type": "phrase",
"query": "comersial",
"fuzziness": "AUTO"
}
}
}
}
{
"took": 16,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.19178303,
"hits": [
{
"_index": "index1",
"_type": "myType",
"_id": "1",
"_score": 0.19178303,
"_source": {
"field1": "Commercial Banks"
}
}
]
}
}
情况2:多个名词搜索
GET index1/myType/_search
{
"query": {
"match": {
"field1": {
"type": "phrase",
"query": "comersial banks",
"fuzziness": "AUTO"
}
}
}
}
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
因此,在第二种情况下,为什么在执行match_phrase
查询时找不到文档? 我有什么想念的吗? 这些结果令人怀疑我所知道的。 我是否使用了模糊搜索? 我不确定这是否是问题,还是我不了解该行为。
在此先非常感谢您阅读我的问题。 希望您能帮到我。
词组查询不支持模糊性。
当前,ES对此保持沉默,即,它允许您指定参数,但不会警告您不支持该参数。 存在可以解决此问题的请求(#18322) (与问题#7764有关 )。 一旦合并到ES 5中,此查询将出错。
在5.0的重大更改文档中,我们可以看到它不受支持:
如果将
cross_fields
,phrase
或phrase
phrase_prefix
类型使用fuzziness
则multi_match
查询将失败。 对于这些类型的multi_match
此参数之前没有记录,并且已被静默忽略。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.