elasticsearch7.1安裝analysis-ik中文分詞插件


首先確保機器應安裝好elasticsearch服務,參考centos7安裝運行Elasticsearch7.1

插件版本和es版本要保持一致,直接運行以下命令完成安裝,重啟es即可。

[root@guangzhou elasticsearch]$ su elk && pwd
/usr/local/elasticsearch
[elk@guangzhou elasticsearch]$ ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.1.1/elasticsearch-analysis-ik-7.1.1.zip
#安裝成功查看下plugins目錄,可見新增的文件analysis-ik
[elk@guangzhou elasticsearch]$ ll plugins/
總用量 4
drwxr-xr-x 2 elk elk 4096 2月 8 14:37 analysis-ik
[elk@guangzhou elasticsearch]$ ll config/
總用量 44
drwxr-x--- 2 elk elk 4096 2月 8 14:37 analysis-ik
-rw-rw---- 1 elk elk 199 2月 7 16:08 elasticsearch.keystore
-rw-rw---- 1 elk elk 2855 2月 8 16:16 elasticsearch.yml
-rw-rw---- 1 elk elk 3544 2月 8 16:11 jvm.options
-rw-rw---- 1 elk elk 17170 5月 23 2019 log4j2.properties
-rw-rw---- 1 elk elk 473 5月 23 2019 role_mapping.yml
-rw-rw---- 1 elk elk 197 5月 23 2019 roles.yml
-rw-rw---- 1 elk elk 0 5月 23 2019 users
-rw-rw---- 1 elk elk 0 5月 23 2019 users_roles

#開兩個窗口,一個啟動elasticsearch,另一個輸入以下命令,可以看到分詞后的效果
[elk@guangzhou elasticsearch]$ curl -H 'Content-Type: application/json'  -XGET 'localhost:9200/_analyze?pretty' -d '{"text":"熱烈 慶祝滬昆高速開通"}'
{
  "tokens" : [
    {
      "token" : "",
      "start_offset" : 0,
      "end_offset" : 1,
      "type" : "<IDEOGRAPHIC>",
      "position" : 0
    },
    {
      "token" : "",
      "start_offset" : 1,
      "end_offset" : 2,
      "type" : "<IDEOGRAPHIC>",
      "position" : 1
    },
    {
      "token" : "",
      "start_offset" : 2,
      "end_offset" : 3,
      "type" : "<IDEOGRAPHIC>",
      "position" : 2
    },
    {
      "token" : "",
      "start_offset" : 3,
      "end_offset" : 4,
      "type" : "<IDEOGRAPHIC>",
      "position" : 3
    },
    {
      "token" : "",
      "start_offset" : 4,
      "end_offset" : 5,
      "type" : "<IDEOGRAPHIC>",
      "position" : 4
    },
    {
      "token" : "",
      "start_offset" : 5,
      "end_offset" : 6,
      "type" : "<IDEOGRAPHIC>",
      "position" : 5
    },
    {
      "token" : "",
      "start_offset" : 6,
      "end_offset" : 7,
      "type" : "<IDEOGRAPHIC>",
      "position" : 6
    },
    {
      "token" : "",
      "start_offset" : 7,
      "end_offset" : 8,
      "type" : "<IDEOGRAPHIC>",
      "position" : 7
    },
    {
      "token" : "",
      "start_offset" : 8,
      "end_offset" : 9,
      "type" : "<IDEOGRAPHIC>",
      "position" : 8
    },
    {
      "token" : "",
      "start_offset" : 9,
      "end_offset" : 10,
      "type" : "<IDEOGRAPHIC>",
      "position" : 9
    }
  ]
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM