安装IK分词器:
下载链接(如果es版本不同可以修改下版本号):https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.1/elasticsearch-analysis-ik-7.12.1.zip
通常下载是比较慢的:有需要可以从本文章附件资源下载,下载完后放到windows系统插件映射目录下。
依次执行
以下有些目录路径和es安装设置时相关,具体看文章:https://blog.csdn.net/sinat_37828702/article/details/134239500
C:\Users\lxh>docker exec -it es /bin/bash
[root@0172f441db52 elasticsearch]# mkdir /usr/share/elasticsearch/plugins/ik
mkdir: cannot create directory '/usr/share/elasticsearch/plugins/ik': File exists
[root@0172f441db52 elasticsearch]# mv /usr/share/elasticsearch/plugins/elasticsearch-analysis-ik-7.12.1.zip /usr/share/elasticsearch/plugins/ik
[root@0172f441db52 elasticsearch]# cd /usr/share/elasticsearch/plugins/ik
[root@0172f441db52 ik]# unzip elasticsearch-analysis-ik-7.4.0.zip
unzip: cannot find or open elasticsearch-analysis-ik-7.4.0.zip, elasticsearch-analysis-ik-7.4.0.zip.zip or elasticsearch-analysis-ik-7.4.0.zip.ZIP.
[root@0172f441db52 ik]# unzip elasticsearch-analysis-ik-7.12.1.zip
Archive: elasticsearch-analysis-ik-7.12.1.zip
inflating: elasticsearch-analysis-ik-7.12.1.jar
inflating: httpclient-4.5.2.jar
inflating: httpcore-4.4.4.jar
inflating: commons-logging-1.2.jar
inflating: commons-codec-1.9.jar
creating: config/
inflating: config/extra_stopword.dic
inflating: config/extra_single_word.dic
inflating: config/main.dic
inflating: config/surname.dic
inflating: config/quantifier.dic
inflating: config/preposition.dic
inflating: config/extra_single_word_full.dic
inflating: config/IKAnalyzer.cfg.xml
inflating: config/suffix.dic
inflating: config/stopword.dic
inflating: config/extra_single_word_low_freq.dic
inflating: config/extra_main.dic
inflating: plugin-descriptor.properties
inflating: plugin-security.policy
[root@0172f441db52 ik]# rm -rf elasticsearch-analysis-ik-7.12.1.zip
[root@0172f441db52 ik]#
参考文章:链接
注:后来发现windows只需要在windows指定目录映射文件直接解压插件压缩包到ik文件夹就行了!
重启es
C:\Users\lxh>docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d1008e018083 kibana:7.12.1 "/bin/tini -- /usr/l…" 4 hours ago Up 4 hours 0.0.0.0:5601->5601/tcp kibana
0172f441db52 elasticsearch:7.12.1 "/bin/tini -- /usr/l…" 5 hours ago Up 5 hours 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp es
C:\Users\lxh>docker restart es
es
C:\Users\lxh>