1、安装插件
cd /usr/local/elasticsearch/bin
./elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.1.2/elasticsearch-analysis-ik-6.1.2.zip
创建索引
curl -XPUT http://192.168.2.127:9200/index
创建map
curl -H 'Content-Type:application/json' http://192.168.202.127:9200/index/fulltext/_mapping -d'
{
"properties": {
"content": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
}
}
}'
分词
curl -H 'Content-Type:application/json' 'http://192.168.202.127:9200/index/_analyze?pretty=true' -d '
{
"text":"中华人民共和国",
"analyzer" : "ik_max_word"
}'