文章40 | 阅读 24061 | 点赞0
value:查询的关键字
boost:查询的权值,默认值是1.0
min_similarity:设置匹配的最小相似度,默认值为0.5, 对于字符串,取值为0-1(包括0和1);对于数值,取值可能大于1;对于日期型取值为1d,1m等,1d就代表1天
prefix_length:指明区分词项的共同前缀长度,默认是0
max_expansions:查询中的词项可以扩展的数目,默认可以无限大
GET /ib3/user/ search { "queny":{ "fuzy*:{ *interests": "chagge* }}}
GET /ib3/user/_ search { "query":{ "fuzzy*: { "interests":{ "value*: "chagge" }}}
#下面可以明显查询条件写错了,但是我们使用模糊查询就可以查询出来,模糊查询很简单
#fuzzy模糊查询
GET /lib3/user/_search
{
"query": {
"fuzzy": {"name": "zholiu"}
}
}
{
"took" : 587,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.23973508,
"hits" : [
{
"_index" : "lib3",
"_type" : "user",
"_id" : "1",
"_score" : 0.23973508,
"_source" : {
"name" : "zhaoliu",
"address" : "hei long jiang sheng tie ling shi",
"age" : 50,
"birthday" : "1970-12-12",
"interests" : "xi buan hejiu, duanlian, lvyou"
}
}
]
}
}
GET /lib3/user/_search
{
"query": {
"fuzzy": {
"interests": {"value": "chagge"}
}
}
}
{
"took" : 35,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 0.57762265,
"hits" : [
{
"_index" : "lib3",
"_type" : "user",
"_id" : "2",
"_score" : 0.57762265,
"_source" : {
"name" : "zhaoming",
"address" : "bei jing hai dian qu qing he zhen",
"age" : 20,
"birthday" : "1998-10-12",
"interests" : "xi huan hejiu, duanlian, changge"
}
},
{
"_index" : "lib3",
"_type" : "user",
"_id" : "5",
"_score" : 0.23973508,
"_source" : {
"name" : "zhangsan",
"address" : "bei jing chao yang qu",
"age" : 29,
"birthday" : "1988-10-12",
"interests" : "xi huan tingyinyue , changge , tiaowu"
}
},
{
"_index" : "lib3",
"_type" : "user",
"_id" : "3",
"_score" : 0.23973508,
"_source" : {
"name" : "lisi",
"address" : "bei jing hai dian qu qing he zhen",
"age" : 23,
"birthday" : "1998-10-12",
"interests" : "xi huan hejiu,duanlian, changge"
}
}
]
}
}
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/ywl470812087/article/details/104931806
内容来源于网络,如有侵权,请联系作者删除!