IK分词器 Github 地址:https://github.com/medcl/elas... html
由于我安装的 Elasticsearch 是5.6.9版本,因此对应安装 elasticsearch-analysis-ik-5.6.9 版本git
$ ./bin/elasticsearch-plugin install http://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.9/elasticsearch-analysis-ik-5.6.9.zip
或者本身下载解压安装到your-es-root/plugins/
下,而后重启elasticsearchgithub
$ cp /mnt/hgfs/elasticsearch-analysis-ik-5.6.9/elasticsearch/ /opt/elasticsearch-5.6.9/plugins/ -r
启动过程当中会打印日志loaded plugin [analysis-ik]
:express
[2018-06-15T09:30:34,671][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [aggs-matrix-stats] [2018-06-15T09:30:34,671][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [ingest-common] [2018-06-15T09:30:34,671][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [lang-expression] [2018-06-15T09:30:34,671][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [lang-groovy] [2018-06-15T09:30:34,671][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [lang-mustache] [2018-06-15T09:30:34,671][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [lang-painless] [2018-06-15T09:30:34,671][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [parent-join] [2018-06-15T09:30:34,671][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [percolator] [2018-06-15T09:30:34,671][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [reindex] [2018-06-15T09:30:34,672][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [transport-netty3] [2018-06-15T09:30:34,672][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded module [transport-netty4] [2018-06-15T09:30:34,672][INFO ][o.e.p.PluginsService ] [_JHOtaZ] loaded plugin [analysis-ik] # 出现这行,则说明加载ik分词器插件成功 [2018-06-15T09:30:37,398][INFO ][o.e.d.DiscoveryModule ] [_JHOtaZ] using discovery type [zen] [2018-06-15T09:30:38,365][INFO ][o.e.n.Node ] initialized [2018-06-15T09:30:38,365][INFO ][o.e.n.Node ] [_JHOtaZ] starting ...
重启less
$ jps #查看pid $ kill pid $ ./bin/elasticsearch -d # 后台运行
教程:http://keenwon.com/1404.html curl
elasticsearch内置分词器:elasticsearch
_analyze
ik的两种分词方式url
# 新建test索引 $ curl -XPUT 'http://127.0.0.1:9200/test' # 验证 ik_max_word 的分词效果 $ curl 'http://127.0.0.1:9200/test/_analyze?analyzer=ik_max_word&pretty=true' -d '{"text":"中华人民共和国"}' # 验证 ik_smart 的分词效果 $ curl 'http://127.0.0.1:9200/test/_analyze?analyzer=ik_smart&pretty=true' -d '{"text":"中华人民共和国"}'