elasticsearch使用版本5.6.3,須要jdk版本1.8,低於該版本不能使用java
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.3.zipgit
一、進入目錄C:\test\es\elasticsearch-5.6.3\bingithub
二、點擊elasticsearch.bat便可啓動app
一、進入目錄C:\test\es\elasticsearch-5.6.3\bincurl
二、執行命令elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.3/elasticsearch-analysis-ik-5.6.3.zipelasticsearch
一、建立分詞索引庫url
curl -PUT http://localhost:9200/fenci_1/ { "mappings": { "mynames": { "properties": { "content": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word" } } } } }
二、搜索切詞驗證spa
ik_max_wordblog
http://192.168.4.131:9201/fenci_1/_analyze?text=中華人民共和國MN&tokenizer=ik_max_word索引
ik_smart
http://localhost:9200/fenci_1/_analyze?text=中華人民共和國MN&tokenizer=ik_smart
三、添加索引數據
curl -XPOST http://localhost:9200/fenci_1/mynames/1 -d' {"content":"美國留給伊拉克的是個爛攤子嗎"} ' curl -XPOST http://localhost:9200/fenci_1/mynames/2 -d' {"content":"公安部:各地校車將享最高路權"} ' curl -XPOST http://localhost:9200/fenci_1/mynames/3 -d' {"content":"中韓漁警衝突調查:韓警平均天天扣1艘中國漁船"} ' curl -XPOST http://localhost:9200/fenci_1/mynames/4 -d' {"content":"中國駐洛杉磯領事館遭亞裔男子槍擊 嫌犯已自首"} '
四、搜索
curl -XPOST http://localhost:9200/fenci_1/mynames/_search -d' { "query" : { "match" : { "content" : "中國" }} }