fuzzy fuzzy queries
value: keyword query
boost: the weight of the query, the default value is 1.0
min_similarity: minimum similarity matching set, the default value is 0.5, for a string of 0-1 (including 0 and 1); for values the value may be greater than 1; for the value of the date of type 1d, 1m, etc., 1d represents one day
prefix_length: indicates the length of the common prefix distinguishing lexical items, the default is 0
max_expansions: terms in the query may be expanded the number of default can infinity
the GET / IB3 / User / Search { "queny": { "Processes with Long Dead *: {* Interests": "chagge *}}}
the GET / IB3 / User / _ Search {" Query ": {" Fuzzy *: { "interests": { "value * :" chagge "}}}
# The following query can obviously wrong, but we use fuzzy queries can check out, very simple fuzzy query
#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"
}
}
]
}
}