Elasticsearch-字段录入中文之后,wildcard模糊查询只能单个字搜索,多个字搜索没有结果
目录
Elasticsearch 字段录入中文之后,wildcard模糊查询只能单个字搜索,多个字搜索没有结果
"query":{
"bool":{
"must":[
{"bool":{
"should":[
{"wildcard":{"mobile":"*小小*"}},
{"wildcard": {"name": "*小小*"}} //这里需要加中文
]}
}
]
}
}
最简单的解决办法就是把wildcard 换成 match_phrase
"query":{
"bool":{
"must":[
{"bool":{
"should":[
{"wildcard":{"mobile":"*小小*"}},
{"match_phrase": {"name": "*小小*"}} //这里需要加中文
]}
}
]
}
}
should和must同时使用
“bool”:{
must:[
{must条件 },
{“bool”:{“should”:[]}}
]
}