@leo 运行在服务器执行 $ /usr/share/elasticsearch/bin/elasticsearch-plugin list
这个命令得到的是空的列表,应该是 IK 插件有没有正确安装,因为现在最新版的elasticsearch是6.4.2版的,但是elasticsearch-analysis-ik 这个插件最新版的是6.4.1的,然后应该是不兼容吧
@windtalker 怎么操作啊 兄弟 我这里报错了
正在处理索引 products
索引不存在,准备创建
In Connection.php line 615:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Custom Anal
yzer [ik_smart_synonym] failed to find tokenizer under name [ik_smart]"}],"type":"
illegal_argument_exception","reason":"Custom Analyzer [ik_smart_synonym] failed to
find tokenizer under name [ik_smart]"},"status":400}
@Flourishing 这个就是plugin里面没有elasticsearch-analysis-ik,现在适配版本已经出来了,在自己的服务器上面(这个目录/usr/share/elasticsearch/bin)运行这个
elasticsearch-plugin install https://github.com/medcl/elasticsearch-ana...
@lianglunzhong 你可以看下你的阿里云服务器下面的这个目录下有没有elasticsearch-plugin这个命令,你也可以把这个bin目录设置到系统的PATH里面,就不用到这个目录下执行这个命令了。
我用上面的方法一直安装不成功,原因是版本的兼容问题,到GitHub上找最新版本下载更新就行https://github.com/medcl/elasticsearch-analysis-ik/releases
安装完成后一定要记得重启
systemctl restart elasticsearch.service
手动更新对应版本 /usr/share/elasticsearch/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-ana...
对,是elasticsearch版本和IK版本不对应造成的,选择对应版本的IK进行安装就可以了(步骤7),但是如果elasticsearch版本过高,IK没有对应版本的话就需要对elasticsearch进行降级
1、卸载elasticsearch
sudo apt-get --purge autoremove elasticsearch
2、删除目录:
sudo rm -rf /var/lib/elasticsearch/
sudo rm -rf /etc/elasticsearch
3、下载deb文件
下载地址:elasticsearch.cn/download/
4、安装
选择需要版本的安装文件sudo dpkg -i elasticsearch-7.10.2.deb
5、启动服务sudo service elasticsearch start
6、测试:curl localhost:9200
7、安装Ik
IK版本选择地址:github.com/medcl/elasticsearch-ana...
然后安装对应的IK,
cd /usr/share/elasticsearch/bin
./elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.2/elasticsearch-analysis-ik-7.4.2.zip
8、重启elasticsearchsystemctl restart elasticsearch.service
推荐文章: