ES 对外提供http的API接口,可以通过简单的http访问来对数据进行操作。 作为初学者,我选择postman这个工具来模拟http访问(给自己个666)。
索引
- 新建Index (weather)
Request
URL: http://localhost:9200/weather
Method: PUT
Response
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "weather"
}
- 删除Index (weather)
Request
URL: http://localhost:9200/weather
Method: DELETE
Response
{
"acknowledged": true
}
中文分词
这里我们需要先安装中文分词插件(我安装了smartcn)。 由于国内网络的问题,推荐先下载对应与ES对应版本的插件,然后本地安装
smartcn: https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-smartcn/analysis-smartcn-*.*.*.zip
elasticsearch-analysis-ik:
https://github.com/medcl/elasticsearch-analysis-ik/releases
安装命令
sudo bin/elasticsearch-plugin install file:///path/to/plugin.zip
安装完成之后,重启ES即可生效。