你好,看了你对这个问题的回答:http://elasticsearch.cn/question/407
然后我如下设置了mapping:
"properties":{
"employs":{
"properties":{
"name":{
"type":"multi_field",
"fields":{
"pinyin":{"type":"string","analyzer":"ngram_pinyin_analyzer"},
"full_pinyin":{"type": "string","analyzer":"my_pinyin_analyzer"},
"first_letter":{"type": "string","analyzer":"pinyin_first_letter"},
"name": {"type":"string","analyzer":"ik_smart"}
}
},
"jobs":{"type":"string","index":"no"}
}
}
仅仅对employs.name进行了拼音和IK分词,在搜索的时候该怎么指定employs.name进行pinyin搜索呢?
然后我如下设置了mapping:
"properties":{
"employs":{
"properties":{
"name":{
"type":"multi_field",
"fields":{
"pinyin":{"type":"string","analyzer":"ngram_pinyin_analyzer"},
"full_pinyin":{"type": "string","analyzer":"my_pinyin_analyzer"},
"first_letter":{"type": "string","analyzer":"pinyin_first_letter"},
"name": {"type":"string","analyzer":"ik_smart"}
}
},
"jobs":{"type":"string","index":"no"}
}
}
仅仅对employs.name进行了拼音和IK分词,在搜索的时候该怎么指定employs.name进行pinyin搜索呢?
2 个回复
yyl211
赞同来自: medcl
使用方法:
{
"query": {
"multi_match": {
"query": "liudehua",
"fields": [
"employs.name",
"employs.name.pinyin",
"employs.name.full_pinyin"
]
}
}
}
qq123 - 90后IT精英
赞同来自: