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":"中華人民共和國"}'