在ElasticSearch中使用模糊和前缀匹配Span_multii



我的用例是在基于模糊和前缀匹配检索的字段中突出显示多个短语/单词。为此,我目前使用span_near处理短语,span_multi允许在短语术语中使用模糊性。我还需要使用prefix_length,这样模糊只允许用于前缀匹配后的字符,但span_multi不允许多个多术语查询。还有其他方法可以做到这一点吗?

"query":{
"bool":{
"should":[{
"span_near": {
"clauses": [
{
"span_multi": {
"match": {
"fuzzy": {
"comment": {
"fuzziness": "5",
"value": "Beata"
}
}
}
}
},
{
"span_multi": {
"match": {
"fuzzy": {
"comment": {
"fuzziness": "5",
"value": "Rosenane"
}
}
}
}
}
],
"in_order": False,
}},{
"span_near": {
"clauses": [
{
"span_multi": {
"match": {
"fuzzy": {
"comment": {
"fuzziness": "5",
"value": "Christna"
}
}
}
}
}
],
"in_order": False,
}}]
}
},
"highlight" : {
"fields" : {
"comment" : { "pre_tags" : ["<temp>"], "post_tags" : ["</temp>"],
"number_of_fragments" : 0
}
}
}

}

嘿,它正在使用

"comment": {
"fuzziness": "5",
"value": "Rosenane",
"prefix_match":3
}

最新更新