如同磁铁吸引四周的铁粉,热情也能吸引周围的人,改变周围的情况。

你好,请教es5.2 如何设置默认分词器为ik?谢谢

Elasticsearch | 作者 youngpand | 发布于2017年04月17日 | 阅读数:11191

你好,请教下面问题:
背景:我使用ES 5.2.2,安装分词analysis-ik-5.2.2
在搜索关键词(北京)时,发现使用的分析器仍然为ES自带的标准分析器,见附件图。
问题:
如何设置默认为ik分析器?谢谢!
img20170417-000809.png
已邀请:

medcl - 今晚打老虎。

赞同来自:

#通过模板设置全局默认分词器

curl -XDELETE http://localhost:9200/_template/rtf


curl -XPUT http://localhost:9200/ _template/rtf
-d'
{
"template": "*",
"settings": { "number_of_shards": 1 },
"mappings": {
"_default_": {
"_all": {
"enabled": true
},
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "text",
"analyzer":"ik_max_word",
"ignore_above": 256,
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
]
}
}
}
'

youngpand

赞同来自:

感谢 @medcl 的及时回复。
我的模板设置完成后,通过HEAD插件中的“动作”-〉“测试分析器” 发现IK未仍然没有生效。是我查看的方式不对么?请教该如何知道 IK分词器已经生效了?再次感谢!@medcl

youngpand

赞同来自:

完整测试流程:
 

要回复问题请先登录注册