共计 1410 个字符,预计需要花费 4 分钟才能阅读完成。
elasticsearch 支持中文分词 Ik 安装文档如下:
1. 下载安装包
插件 git 地址:https://github.com/medcl/elasticsearch-analysis-ik/releases
插件下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.3.0/elasticsearch-analysis-ik-5.3.0.zip
2、在 elasticsearch 中创建 ik 的安装目录
[root@elasticsearch-01]# mkdir /usr/local/elasticsearch/plugins/ik
[root@elasticsearch-01]# cd /usr/local/elasticsearch/plugins/ik
[root@elasticsearch-01 ik]# wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.3.0/elasticsearch-analysis-ik-5.3.0.zip
[root@elasticsearch-01 ik]# unzip -x elasticsearch-analysis-ik-5.0.2.zip
[root@elasticsearch-01 ik]# yum -y install tree
[root@elasticsearch-01 ik]# tree -F -t -L 3
.
├── plugin-descriptor.properties
├── elasticsearch-analysis-ik-5.3.0.jar
├── commons-codec-1.9.jar
├── commons-logging-1.2.jar
├── httpclient-4.5.2.jar
├── httpcore-4.4.4.jar
└── config/
├── custom/
│ ├── ext_stopword.dic
│ ├── mydict.dic
│ ├── single_word.dic
│ ├── single_word_full.dic
│ ├── single_word_low_freq.dic
│ └── sougou.dic
├── IKAnalyzer.cfg.xml
├── main.dic
├── preposition.dic
├── quantifier.dic
├── stopword.dic
├── suffix.dic
└── surname.dic
2 directories, 19 files
3. 重启 elasticsearch
[root@elasticsearch-01 ik]# systemctl restart elasticsearch.service
[root@elasticsearch-01 ik]# systemctl status elasticsearch.service
4. 验证 ik 是否可用
[root@elasticsearch-01 ik]# curl -XGET ‘http://127.0.0.1:9200/_analyze?pretty&analyzer=ik_max_word’ -d ‘ 想要查询的中文内容 ’
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-09/147009.htm