1、创建索引
创建索引语法规则:http://elasticsearch 服务器访问地址/索引名称,Put请求, 无参数
实列:http://192.168.1.74:9200/security/,在elasticsearch 服务器上创建名为security 的索引。
截图:
![](https://img-blog.csdnimg.cn/20190723145022476.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3V6aGl3ZW5nYW5n,size_16,color_FFFFFF,t_70)
注意:(1)、索引不能包含大写字母。
(2)、索引不能重复创建。
2、创建索引并且指定索引配置参数:
创建索引语法规则:http://elasticsearch 服务器访问地址/索引名称,Put请求,携带index 初始化配置参数
实列:http://192.168.1.74:9200/shopping/,在elasticsearch 服务器上创建名为shopping 的索引,携带shopping 初始化配置参数:{"settings": { "number_of_shards": 3, "number_of_replicas": 1 }
截图:![](https://img-blog.csdnimg.cn/2019072315011870.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3V6aGl3ZW5nYW5n,size_16,color_FFFFFF,t_70)
3、查看索引
查看索引语法规则:http://elasticsearch 服务器访问地址/索引名称/_settings, Get请求,无参数。
实列:http://192.168.1.74:9200/shopping/_settings/,查看elasticsearch 服务器上关于shopping 索引的相关信息。
截图:
![](https://img-blog.csdnimg.cn/20190723150654312.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3V6aGl3ZW5nYW5n,size_16,color_FFFFFF,t_70)
4、查看多个索引
查看多个索引语法规则:http://elasticsearch 服务器访问地址/索引名称1,索引名称2.../_settings, Get请求,无参数。
实列:http://192.168.1.74:9200/shopping,security/_settings/,查看elasticsearch 服务器上关于shopping索引、security索引的相关信息。
截图:
![](https://img-blog.csdnimg.cn/20190723151032505.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3V6aGl3ZW5nYW5n,size_16,color_FFFFFF,t_70)
5、删除索引
删除索引语法规则:http://elasticsearch 服务器访问地址/索引名称, Delete 请求, 无参数
实列:http://192.168.1.74:9200/blog/, elasticsearch 服务器关闭blog 索引。
截图:
![](https://img-blog.csdnimg.cn/20190723151637185.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3V6aGl3ZW5nYW5n,size_16,color_FFFFFF,t_70)
6、禁止/启用 索引
禁用索引语法规则:http://elasticsearch 服务器访问地址/索引名称/_close, Post 请求, 无参数
实列:http://192.168.1.74:9200/shopping/_close/,elasticsearch 服务器关闭shopping 索引。
截图:
![](https://img-blog.csdnimg.cn/20190723152021244.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3V6aGl3ZW5nYW5n,size_16,color_FFFFFF,t_70)
启用索引语法规则:http://elasticsearch 服务器访问地址/索引名称/_open, Post 请求, 无参数
实列:http://192.168.1.74:9200/shopping/_open/,elasticsearch 服务器重新开启shopping 索引。
截图:
![](https://img-blog.csdnimg.cn/20190723152234109.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3V6aGl3ZW5nYW5n,size_16,color_FFFFFF,t_70)