1.首先得知道ik分词器的地址
GitHub:GitHub - medcl/elasticsearch-analysis-ik
若github访问较慢,可以访问以下网站
mirrors / medcl / elasticsearch-analysis-ik · GitCode
2.手动安装
打开git的命令行
git clone https://github.com/medcl/elasticsearch-analysis-ik
#git clone https://gitcode.net/mirrors/medcl/elasticsearch-analysis-ik
cd elasticsearch-analysis-ik
git checkout tags/{version}
mvn clean
mvn compile
mvn package
然后找到克隆下来的文件进入\target\releases目录中,将elasticsearch-analysis-ik-*.zip解压到ES的\plugins\ik目录下。
3.重启ES
若ES日志文件中报如下错误
[2022-12-09T15:24:51,174][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [DESKTOP-9E7P384] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: Plugin [analysis-ik] was built for Elasticsearch version 7.4.0 but version 7.12.1 is running
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116) ~[elasticsearch-cli-7.12.1.jar:7.12.1]
at org.elasticsearch.cli.Command.main(Command.java:79) ~[elasticsearch-cli-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81) ~[elasticsearch-7.12.1.jar:7.12.1]
Caused by: java.lang.IllegalArgumentException: Plugin [analysis-ik] was built for Elasticsearch version 7.4.0 but version 7.12.1 is running
at org.elasticsearch.plugins.PluginsService.verifyCompatibility(PluginsService.java:342) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.plugins.PluginsService.loadBundle(PluginsService.java:618) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:474) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:158) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.node.Node.<init>(Node.java:336) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.node.Node.<init>(Node.java:278) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:217) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:217) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:397) ~[elasticsearch-7.12.1.jar:7.12.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.12.1.jar:7.12.1]
... 6 more
则进入到\plugins\ik目录下,找到plugin-descriptor.properties文件,将文件中的elasticsearch.version=改为自己的ES版本号
版权归原作者 afei.java 所有, 如有侵权,请联系我们删除。