最近项目上需使用Elasticsearch支持全文检索,以下作为笔记:
1.版本:elasticsearch-6.2.1;
2.将对应ES版本的IK分词器包ik.tar.gz上传至elasticsearch-6.2.1/plugins 目录下解压缩;
3.终端执行 curl 'http://192.168.101.128:9200/_cat/plugins' 如下列表中有analysis-ik,则已生效,若未生效,则重启ES集群;
测试IK分词器:
curl -XGET 'http://192.168.101.128:9200/_analyze?pretty' -H 'Content-Type: application/json' -d '{"analyzer": "ik_smart","text": "I had an amusing experience last year. After I had left a small village in the south of France, I drove on to the next town. 欢迎来到中国!"}'
注:此版本ES在配置文件中添加IK分词器会出现异常:
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: node s