標籤:命令列介面 下載 sdn har guid 無法啟動服務 type under htm
參考:http://blog.csdn.net/xiedongdong1/article/details/52848645
elasticsearch文檔:https://www.elastic.co/guide/cn/elasticsearch/guide/current/intro.html
elasticsearch 內建的中分分詞器將會使中文分成一個一個的單詞,需要安裝ik分詞等,ik分詞分為 ik_smart(最細粒度分詞),ik_max_word(最粗粒度分詞)兩種模式。
1:首先安裝elasticsearch:官網下載elasticsearch zip版本 https://www.elastic.co/downloads/elasticsearch
2:解壓下載的zip包,啟動elasticsearch,有兩種方式:
2.1:進入解壓檔案的bin目錄,雙擊執行elasticsearch.bat
進入 http://localhost:9200 ,出現以下頁面,說明安裝成功。
按Ctrl+c停止
2.2: 安裝成windows服務,進入bin命令列介面下,執行可執行程式elasticsearch-service-x64.exe,即成為系統服務
3:安裝head外掛程式,在網頁上管理、監視叢集的狀態,elasticsearch-head是一個介面化的叢集操作和管理工具
3.1 5.0版本以前 通過elasticsearch 的plugin外掛程式進行安裝,進入bin目錄下進行安裝:elasticsearch/bin/plugin -install mobz/elasticsearch-head
3.2 5.0以後不支援命令列安裝,需要安裝node.js等支援。安裝方法 http://blog.csdn.net/qq3401247010/article/details/78742524
4: 安裝ik分詞外掛程式
首先在git上下載已經編譯好的代碼,一定要選擇和自己的es版本對應,否則無法啟動服務,git如下:
https://github.com/medcl/elasticsearch-analysis-ik/releases
然後把檔案解壓的內容放在es的plugins的analysis-ik目錄下,如果沒有此目錄,則建立。
最後在es的conf中elasticsearch.yml檔案末尾中加入 index.analysis.analyzer.ik.type: "ik"
測試分詞外掛程式是否可以分詞:
在瀏覽器輸入:
http://localhost:9200/_analyze?analyzer=ik&pretty=true&text=中華人民共和國國歌
結果:{ "tokens" : [ { "token" : "中華人民共和國", "start_offset" : 0, "end_offset" : 7, "type" : "CN_WORD", "position" : 0 },{ "token" : "中華人民", "start_offset" : 0, "end_offset" : 4, "type" : "CN_WORD", "position" : 1 },{ "token" : "中華", "start_offset" : 0, "end_offset" : 2, "type" : "CN_WORD", "position" : 2 },{ "token" : "華人", "start_offset" : 1, "end_offset" : 3, "type" : "CN_WORD", "position" : 3 },{ "token" : "人民共和國", "start_offset" : 2, "end_offset" : 7, "type" : "CN_WORD", "position" : 4 },{ "token" : "人民", "start_offset" : 2, "end_offset" : 4, "type" : "CN_WORD", "position" : 5 },{ "token" : "共和國", "start_offset" : 4, "end_offset" : 7, "type" : "CN_WORD", "position" : 6 },{ "token" : "共和", "start_offset" : 4, "end_offset" : 6, "type" : "CN_WORD", "position" : 7 }, {"token" : "國", "start_offset" : 6, "end_offset" : 7, "type" : "CN_CHAR", "position" : 8 },{ "token" : "國歌", "start_offset" : 7, "end_offset" : 9, "type" : "CN_WORD", "position" : 9 } ]}如果想要粗粒度的分詞:則把analyzer的屬性換成ik_smart即可 http://localhost:9200/_analyze?analyzer=ik_smart&pretty=true&text=中華人民共和國國歌結果:{ "tokens" : [ { "token" : "中華人民共和國", "start_offset" : 0, "end_offset" : 7, "type" : "CN_WORD", "position" : 0 },{ "token" : "國歌", "start_offset" : 7, "end_offset" : 9, "type" : "CN_WORD", "position" : 1 } ]}
windows 環境下安裝elasticsearch ,ik,head,marvel