ik下載
- 打開
Github官網,搜索elasticsearch-analysis-ik,單擊medcl/elasticsearch-analysis-ik。或者直接點擊

- 在
readme.md文件中,下拉選擇預編譯版本。

- 由於
ik與elasticsearch存在兼容問題。所以在下載ik時要選擇和elasticsearch版本一致的,也就是選擇v6.5.4版本,單擊elasticsearch-analysis-ik-6.5.4.zip包,自動進入下載到本地。

- 本地下載成功后,是個
zip包。

安裝
- 首先打開
C:\Program Files\elasticseach-6.5.4\plugins目錄,新建一個名為ik的子目錄,並將elasticsearch-analysis-ik-6.5.4.zip包解壓到該ik目錄內也就是C:\Program Files\elasticseach-6.5.4\plugins\ik目錄。

測試
- 首先將
elascticsearch和kibana服務重啟。 - 然后地址欄輸入
http://localhost:5601,在Dev Tools中的Console界面的左側輸入命令,再點擊綠色的執行按鈕執行。
GET _analyze { "analyzer": "ik_max_word", "text": "上海自來水來自海上" }
右側就顯示出結果了如下所示:
{ "tokens" : [ { "token" : "上海", "start_offset" : 0, "end_offset" : 2, "type" : "CN_WORD", "position" : 0 }, { "token" : "自來水", "start_offset" : 2, "end_offset" : 5, "type" : "CN_WORD", "position" : 1 }, { "token" : "自來", "start_offset" : 2, "end_offset" : 4, "type" : "CN_WORD", "position" : 2 }, { "token" : "水", "start_offset" : 4, "end_offset" : 5, "type" : "CN_CHAR", "position" : 3 }, { "token" : "來自", "start_offset" : 5, "end_offset" : 7, "type" : "CN_WORD", "position" : 4 }, { "token" : "海上", "start_offset" : 7, "end_offset" : 9, "type" : "CN_WORD", "position" : 5 } ] }

OK,安裝完畢,非常的簡單。
see also:IK Analysis for Elasticsearch | elasticsearch build-in Analyzers
