ES拼音分词搜索问题

Elasticsearch | 作者 aa1356889 | 发布于2019年04月15日 | 阅读数:406

搜索分词结果
{
"valid": true,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"explanations": [
{
"index": "analyzertest2",
"valid": true,
"explanation": "+productShortName:\"(x xue xh) (h hua) (c chun) (s shuang)\" #*:*"
}
]
}
因为括号里面是or比较  我搜索雪花纯生 也会出来雪花纯爽 因为雪花纯爽会分词  c s
我想让括号里面变成and比较有没有可能
 
我现在做了一个版本就是 搜索的时候 不适用前缀分词  就不会分词cs  但是设置了之后  300ml 做文档分词分词的是300ml  300  ml
但是搜索分词是分词 300  m  l 导致搜索不出数据  
mapping
{
"settings": {
"analysis": {
"analyzer": {
"ik_pinyin_analyzer": {
"type": "custom",
"tokenizer": "ik_max_word",
"filter": ["pinyin_max_word_filter"]
},
"ik_pingying_smark": {
"type": "custom",
"tokenizer": "ik_smart",
"filter": ["pinyin_smark_word_filter"]

}
},
"filter": {
"pinyin_max_word_filter": {
"type": "pinyin",
"keep_joined_full_pinyin": "true",
"keep_separate_first_letter":"true",
"keep_first_letter":"true",
"none_chinese_pinyin_tokenize":true
},
"pinyin_smark_word_filter": {
"type": "pinyin",
"keep_joined_full_pinyin": "false",
"keep_separate_first_letter":"true",
"keep_first_letter":"true",
"none_chinese_pinyin_tokenize":false,
"remove_duplicated_term":true
}
}
}

},
"mappings": {
"doc": {
"properties": {
"productShortName": {
"type": "text",
"analyzer": "ik_pinyin_analyzer",
"search_analyzer":"ik_pingying_smark"
},
"skuNames": {
"type": "text",
"analyzer": "ik_pinyin_analyzer",
"search_analyzer":"ik_pingying_smark"
},
"regionCode": {
"type": "keyword"
}
}
}
}
}
已邀请:

要回复问题请先登录注册