ik分词器安装

三种安装插件的方式:命令行、url、离线安装



第一种:命令行



bin/elasticsearch-plugin install [plugin_name]


bin/elasticsearch-plugin install analysis-smartcn 安装中文分词器


第二种:url安装



bin/elasticsearch-plugin install [url]
#bin/elasticsearch-plugin install https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-smartcn/analysis-smartcn-6.4.0.zip
第三种:离线安装



#https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-smartcn/analysis-smartcn-6.4.0.zip
#点击下载analysis-smartcn离线包
#将离线包解压到ElasticSearch 安装目录下的 plugins 目录下
#重启es。新装插件必须要重启es
注意这种方式安装的插件需要和ES版本一致

https://www.cnblogs.com/wangcuican/p/13872937.html



中文分词器
https://github.com/medcl/elasticsearch-analysis-ik
https://github.com/medcl/elasticsearch-analysis-ik/blob/master/config/IKAnalyzer.cfg.xml
https://www.gushiciku.cn/pl/gLbz/zh-hk
https://github.com/medcl/elasticsearch-analysis-ik/issues/467
https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v7.9.3



拼音分词器:
https://github.com/medcl/elasticsearch-analysis-pinyin



另一个有名的分词器:结巴分词
https://github.com/fxsjy/jieba



% ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.14.0/elasticsearch-analysis-ik-7.14.0.zip



Exception in thread “main” javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)



Plugin [analysis-ik] was built for Elasticsearch version 7.14.0 but version 7.9.3 is running at org.elasticsearch.plugins.PluginsService.verifyCompatibility(PluginsService.java:349)



% vi plugins/elasticsearch-analysis-ik-7.14.0/plugin-descriptor.properties https://blog.csdn.net/qq_35170213/article/details/89054847



try load config from /Users/xiazemin/software/elasticsearch-7.9.3/config/analysis-ik/IKAnalyzer.cfg.xml [2021-09-28T10:31:33,627][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [xiazemindeMacBook-Pro.local] fatal error in thread [elasticsearch[xiazemindeMacBook-Pro.local][clusterApplierService#updateTask][T#1]], exiting java.lang.NoClassDefFoundError: org/elasticsearch/core/PathUtils



% mkdir -p config/analysis-ik % vi config/analysis-ik/IKAnalyzer.cfg.xml



Es 版本和 ik分词器版本不一致。
由于我用的Es时最新版本 6.7.1,而ik分词器master编译出来也只是6.5.0



解决办法
修改 plugin-descriptor.properties 文件中的



elasticsearch.version=你的ES版本号



有些版本是不支持的,最好下载相同版本的
https://blog.csdn.net/qq_35170213/article/details/89054847



Category elasticsearch