dst*_*arh 10 search wildcard elasticsearch
我们有一个项目索引,我试图在项目名称上做模糊通配符.查询
{
"from": 0,
"size": 10,
"query": {
"bool": {
"must": {
"query_string": {
"fields": [
"name.suggest"
],
"query": "avacado*",
"fuzziness": 0.7
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
索引中的字段和播放中的分析器"
suggest_analyzer":{
"type": "custom",
"tokenizer": "standard",
"filter": ["standard", "lowercase", "shingle", "punctuation"]
}
"punctuation" : {
"type" : "word_delimiter",
"preserve_original": "true"
}
"name": {
"fields": {
"name": {
"type": "string",
"analyzer": "stem"
},
"suggest":{
"type": "string",
"analyzer": "suggest_analyzer"
},
"untouched": {
"include_in_all": false,
"index": "not_analyzed",
"index_options": "docs",
"omit_norms": true,
"type": "string"
},
"untouched_lowercase": {
"type": "string",
"index_analyzer": "lowercase",
"search_analyzer": "lowercase"
}
},
"type": "multi_field"
},
Run Code Online (Sandbox Code Playgroud)
问题是这个
名称为"Avocado Test"的项目将匹配以下内容
但无法匹配
我似乎无法使用通配符进行模糊处理,它似乎是模糊的工作或通配符工作,但不是组合.
Es版本是1.3.1
请注意,我的查询已经简化,我们还有其他过滤功能,但我将其简化为查询,以消除结果中的任何歧义.我试图使用建议功能,但它们不允许我们需要的过滤级别.
有没有其他方法来处理建议/先行样式搜索与模糊来捕捉拼写错误?
| 归档时间: |
|
| 查看次数: |
3174 次 |
| 最近记录: |