1. 程式人生 > >ElasticSearch 6.5.4 安裝中文分詞器 IK和pinyiin

ElasticSearch 6.5.4 安裝中文分詞器 IK和pinyiin

ES的常用的中文分詞有基於漢字的ik和基於拼音的pinyin

https://github.com/medcl/elasticsearch-analysis-ik/releases

https://github.com/medcl/elasticsearch-analysis-pinyin

安裝的時候主要選擇elasticsearch版本一致的外掛:
-- ES的版本查詢:
# /usr/share/elasticsearch/bin/elasticsearch -V
Version: 6.5.4, Build: default/rpm/d2ef93d/2018-12-17T21:17:40.758843Z, JVM: 1.8.0_192

安裝方式:
1.直接使用zip包,下載解壓到plugin目錄部署,此方式適合下載一次多次應用的場景。

2.使用Elasticsearch自己帶的命令安裝zip包。線上安裝zip包視視網路環境而定。

由於使用的RPM安裝的,可以直接使用命令:
# rpm -ql elasticsearch  | grep -i elasticsearch-plugin 
/usr/share/elasticsearch/bin/elasticsearch-plugin
/usr/share/elasticsearch/lib/tools/plugin-cli/elasticsearch-plugin-cli-6.5.4.jar

# cd /usr/share/elasticsearch/bin/

# ./elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.4/elasticsearch-analysis-ik-6.5.4.zip
-> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.4/elasticsearch-analysis-ik-6.5.4.zip
[=================================================] 100%   
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.net.SocketPermission * connect,resolve
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.

Continue with installation? [y/N]y
-> Installed analysis-ik



--驗證安裝是否成功:
# curl http://192.168.3.113:9200/_cat/plugins
GS9-MID analysis-ik 6.5.4


# wget https://github.com/medcl/elasticsearch-analysis-pinyin/releases/download/v6.5.4/elasticsearch-analysis-pinyin-6.5.4.zip

#mkdir -p /usr/share/elasticsearch/plugins/analysis-pinyin
# unzip elasticsearch-analysis-pinyin-6.5.4.zip -d /usr/share/elasticsearch/plugins/analysis-pinyin/

--版本檢視:
# curl http://192.168.3.113:9200/_cat/plugins
GS9-MID analysis-ik     6.5.4
GS9-MID analysis-pinyin 6.5.4