有个人长的像洋葱,走着走着就哭了…….

es 6.8.3 ik分词器,搜索数字+中文 出不来结果

Elasticsearch | 作者 elroy | 发布于2020年02月29日 | 阅读数:1003

有一本书 叫 82年生的金智英 name 用的是 ik_smart 分词 ,搜索82或年或82年生都能出来结果,搜索82年出不来,有什么办法解决吗
这是建立索引的mapping的 name 字段
"name" : {
"type" : "text",
"analyzer" : "ik_smart",
"search_analyzer" : "ik_smart"
},
这是整个查询语句,因为 英文+数字 比如 testing1 搜索 test 查不出 testing1结果,所以加了 wildcard 去查询。
{
"bool" : {
"must_not" : [
{
"term" : {
"status" : {
"value" : 0,
"boost" : 1.0
}
}
},
{
"term" : {
"status" : {
"value" : 2,
"boost" : 1.0
}
}
},
{
"term" : {
"status" : {
"value" : 3,
"boost" : 1.0
}
}
},
{
"term" : {
"saleStatus" : {
"value" : 0,
"boost" : 1.0
}
}
},
{
"term" : {
"saleStatus" : {
"value" : 2,
"boost" : 1.0
}
}
},
{
"term" : {
"saleStatus" : {
"value" : 4,
"boost" : 1.0
}
}
}
],
"should" : [
{
"match" : {
"summary" : {
"query" : "82年",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"minimum_should_match" : "75%",
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 2.0
}
}
},
{
"match" : {
"name" : {
"query" : "82年",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"minimum_should_match" : "75%",
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 3.0
}
}
},
{
"match" : {
"ext.translator" : {
"query" : "82年",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"minimum_should_match" : "75%",
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 1.0
}
}
},
{
"match" : {
"ext.author" : {
"query" : "82年",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"minimum_should_match" : "75%",
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 1.0
}
}
},
{
"match" : {
"categorys.name" : {
"query" : "82年",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"minimum_should_match" : "75%",
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 1.0
}
}
},
{
"match" : {
"productNum" : {
"query" : "82年",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"minimum_should_match" : "75%",
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 3.0
}
}
},
{
"match" : {
"introduction" : {
"query" : "82年",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"minimum_should_match" : "75%",
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 2.0
}
}
},
{
"match" : {
"ext.publisher" : {
"query" : "82年",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"minimum_should_match" : "75%",
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 1.0
}
}
},
{
"match" : {
"tags.name" : {
"query" : "82年",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"minimum_should_match" : "75%",
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 1.0
}
}
},
{
"wildcard" : {
"summary" : {
"wildcard" : "82年*",
"boost" : 1.0
}
}
},
{
"wildcard" : {
"name" : {
"wildcard" : "82年*",
"boost" : 1.0
}
}
},
{
"wildcard" : {
"ext.translator" : {
"wildcard" : "82年*",
"boost" : 1.0
}
}
},
{
"wildcard" : {
"ext.author" : {
"wildcard" : "82年*",
"boost" : 1.0
}
}
},
{
"wildcard" : {
"categorys.name" : {
"wildcard" : "82年*",
"boost" : 1.0
}
}
},
{
"wildcard" : {
"productNum" : {
"wildcard" : "82年*",
"boost" : 1.0
}
}
},
{
"wildcard" : {
"introduction" : {
"wildcard" : "82年*",
"boost" : 1.0
}
}
},
{
"wildcard" : {
"ext.publisher" : {
"wildcard" : "82年*",
"boost" : 1.0
}
}
},
{
"wildcard" : {
"tags.name" : {
"wildcard" : "82年*",
"boost" : 1.0
}
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
已邀请:

要回复问题请先登录注册