$ wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.2/elasticsearch-analysis-ik-7.4.2.zip
$ cd es根目录/plugins/ && mkdir ik
先 kill 在启动
# 守护进程
$ ./bin/elasticsearch -d -p pid
curl -XPOST http://10.1.0.175:9200/user/userentity
curl -XPOST http://10.1.0.175:9200/user/_mapping -H 'Content-Type:application/json' -d'
{
"properties": {
"content": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_smart"
}
}
}'
上面命令失败时,用这个
创建user索引
curl -X PUT "10.0.1.122:9200/user?include_type_name=true" -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"userentity": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
'
查看es进程
$ ps -ef | grep elastic
启动进程 注意不要是 root 用户,否则启动会失败
$ ./elasticsearch -d