安装IK分词器 下载对应版本的插件 参考:https://github.com/medcl/elasticsearch-analysis-ik/ 参考:https://github.com/medcl/elasticsearch-analysis-ik/releases cd /usr/local/devtools/es/elasticsearch-5.4.3/plugins/zk wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.4.3/elasticsearch-analysis-ik-5.4.3.zip unzip elasticsearch-analysis-ik-5.4.3.zip rm -rf elasticsearch-analysis-ik-5.4.3.zip 中止全部es进程并重启 kill `ps -ef | grep Elasticsearch | grep -v grep | awk '{print $2}'` 重启全部es #建立索引名字叫news,至关于数据库database curl -XPUT http://xupan001:9200/news #建立mapping(至关于数据中的schema信息,表名和字段名以及字段的类型) #至关于数据库database的描述信息 curl -XPOST http://xupan001:9200/news/fulltext/_mapping -d' { "properties": { "content": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word" } } }' curl -XGET 'http://xupan001:9200/_analyze?pretty&analyzer=ik_max_word' -d '联想是全球最大的笔记本厂商' curl -XGET 'http://xupan001:9200/_analyze?pretty&analyzer=ik_smart' -d '联想是全球最大的笔记本厂商' curl -XGET 'http://xupan001:9200/_analyze?pretty&analyzer=ik_max_word' -d ‘中华人民共和国’ curl -XGET 'http://xupan001:9200/_analyze?pretty&analyzer=ik_smart' -d ‘中华人民共和国’ curl -XPUT 'https://xupan001:9200/iktest?pretty' -d '{ "settings" : { "analysis" : { "analyzer" : { "ik" : { "tokenizer" : "ik_max_word" } } } }, "mappings" : { "article" : { "dynamic" : true, "properties" : { "subject" : { "type" : "string", "analyzer" : "ik_max_word" } } } } }'