1、打开找到对应的版本
https://github.com/medcl/elasticsearch-analysis-pinyin/releases
2、复制下载链接安装
例如:
我的elasticsearch是5.6.16
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-pinyin/releases/download/v5.6.16/elasticsearch-analysis-pinyin-5.6.16.zip
3、重启ES!
4、分词测试
GET _analyze { "text": "学习", "analyzer": "pinyin" }
分词结果
{ "tokens": [ { "token": "xue", "start_offset": 0, "end_offset": 1, "type": "word", "position": 0 }, { "token": "xi", "start_offset": 1, "end_offset": 2, "type": "word", "position": 1 }, { "token": "xx", "start_offset": 0, "end_offset": 2, "type": "word", "position": 1 } ] }
自定义参数
