ElasticSearch安裝中文分詞外掛IK

壹頁書發表於2016-05-08
環境:
ES版本:2.3.2
IK版本:1.9.2

IK中文外掛地址


點選下載按鈕,下載原始碼


mvn clean package 編譯打包

將elasticsearch-analysis-ik-master/target/releases 目錄下的elasticsearch-analysis-ik-1.9.2.zip 檔案,
複製到 your-es-root/plugins/ik 目錄下
然後解壓
unzip elasticsearch-analysis-ik-1.9.2.zip 

重啟ES叢集,就可以使用了.

測試一下:
http://192.168.1.105:9200/_analyze?analyzer=ik&pretty=true&text=美利堅人類的希望正義的化身邪惡的剋星
{
  "tokens" : [ {
    "token" : "美利堅",
    "start_offset" : 0,
    "end_offset" : 3,
    "type" : "CN_WORD",
    "position" : 0
  }, {
    "token" : "堅",
    "start_offset" : 2,
    "end_offset" : 3,
    "type" : "CN_WORD",
    "position" : 1
  }, {
    "token" : "人類",
    "start_offset" : 3,
    "end_offset" : 5,
    "type" : "CN_WORD",
    "position" : 2
  }, {
    "token" : "希望",
    "start_offset" : 6,
    "end_offset" : 8,
    "type" : "CN_WORD",
    "position" : 3
  }, {
    "token" : "正義",
    "start_offset" : 8,
    "end_offset" : 10,
    "type" : "CN_WORD",
    "position" : 4
  }, {
    "token" : "化身",
    "start_offset" : 11,
    "end_offset" : 13,
    "type" : "CN_WORD",
    "position" : 5
  }, {
    "token" : "邪惡",
    "start_offset" : 13,
    "end_offset" : 15,
    "type" : "CN_WORD",
    "position" : 6
  }, {
    "token" : "邪",
    "start_offset" : 13,
    "end_offset" : 14,
    "type" : "CN_WORD",
    "position" : 7
  }, {
    "token" : "惡",
    "start_offset" : 14,
    "end_offset" : 15,
    "type" : "CN_WORD",
    "position" : 8
  }, {
    "token" : "剋星",
    "start_offset" : 16,
    "end_offset" : 18,
    "type" : "CN_WORD",
    "position" : 9
  }, {
    "token" : "克",
    "start_offset" : 16,
    "end_offset" : 17,
    "type" : "CN_WORD",
    "position" : 10
  }, {
    "token" : "星",
    "start_offset" : 17,
    "end_offset" : 18,
    "type" : "CN_CHAR",
    "position" : 11
  } ]
}




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29254281/viewspace-2095945/,如需轉載,請註明出處,否則將追究法律責任。

相關文章