问题描述
elasticsearch通过api创建index的时候),通过setting制定为standard分词(如图1),并且在index的setting中已经看到该配置生效了(如图2),同时elasticsearch的配置文件elasticsearch.yml中配置了ik分词(如图3),然后数据进入到索引之后,发现该index使用的还是ik分词(可以通过搜索来测试得出结论,先通过关键字“人民”搜索字段“title”,可以搜索一个结果,如图4;然后根据关键字“人”搜索title字段,发现搜不出结果,通过这两个搜索说明,那条记录的title字段使用的仍然是ik分词器。)。
(图1)
(图2)
(图3)
(图4)
(图5)
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
1.elasticsearch使用的版本是2.4.0
2.附上“我爱中国人民共和国”的“ik”分词结果,如下
{
"tokens": [
{
"token": "我",
"start_offset": 0,
"end_offset": 1,
"type": "CN_CHAR",
"position": 0
},
{
"token": "爱",
"start_offset": 1,
"end_offset": 2,
"type": "CN_CHAR",
"position": 1
},
{
"token": "中国人民",
"start_offset": 2,
"end_offset": 6,
"type": "CN_WORD",
"position": 2
},
{
"token": "中国人",
"start_offset": 2,
"end_offset": 5,
"type": "CN_WORD",
"position": 3
},
{
"token": "中国",
"start_offset": 2,
"end_offset": 4,
"type": "CN_WORD",
"position": 4
},
{
"token": "国人",
"start_offset": 3,
"end_offset": 5,
"type": "CN_WORD",
"position": 5
},
{
"token": "人民共和国",
"start_offset": 4,
"end_offset": 9,
"type": "CN_WORD",
"position": 6
},
{
"token": "人民",
"start_offset": 4,
"end_offset": 6,
"type": "CN_WORD",
"position": 7
},
{
"token": "共和国",
"start_offset": 6,
"end_offset": 9,
"type": "CN_WORD",
"position": 8
},
{
"token": "共和",
"start_offset": 6,
"end_offset": 8,
"type": "CN_WORD",
"position": 9
},
{
"token": "国",
"start_offset": 8,
"end_offset": 9,
"type": "CN_CHAR",
"position": 10
}
]
}
你期待的结果是什么?实际看到的错误信息又是什么?
问题出现的环境背景及自己尝试过哪些方法
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
在mapping下的title字段指定分词器