1. 下载和es配套的版本
git clone https://github.com/medcl/elasticsearch-analysis-ik
2. 编译
cd elasticsearch-analysis-ik/ mvn clean package
3. 将release下的zip包拷贝至es/plugins目录下解压,并命名为ik
cd elasticsearch-6.1.1-node3/plugins/ tar zxvf elasticsearch-analysis-ik-6.1.1.zip unzip elasticsearch-analysis-ik-6.1.1.zip mv elasticsearch-analysis-ik-6.1.1.zip ../../ mv elasticsearch ik
4. 重启es
5. 热更新IK分词
ik热更新1分钟发一次请求head请求,检查last modify time 和etag。有变化,则更新。
官方文档很详细:https://github.com/medcl/elasticsearch-analysis-ik
坑:
添加《热更新 IK 分词 》后,
<entry key="remote_ext_dict">http://10.24.235.23:8080/ikanalyzer/terms.dic</entry>
启动抛下面的错:
access denied ("java.net.SocketPermission" "10.24.235.23:8080" "connect,resolve")
解决:
vim /etc/alternatives/jre_1.8.0/lib/security/java.policy 添加: permission java.net.SocketPermission "10.24.235.23:8080","accept"; permission java.net.SocketPermission "10.24.235.23:8080","listen"; permission java.net.SocketPermission "10.24.235.23:8080","resolve"; permission java.net.SocketPermission "10.24.235.23:8080","connect";