ElasticSearch6.x 之索引

虾米姐 阅读:740 2021-03-31 17:19:30 评论:0

1、创建索引

    创建索引语法规则:http://elasticsearch 服务器访问地址/索引名称,Put请求, 无参数

    实列:http://192.168.1.74:9200/security/,在elasticsearch 服务器上创建名为security 的索引。

    截图:

注意:(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 }

截图:

 

3、查看索引

查看索引语法规则:http://elasticsearch 服务器访问地址/索引名称/_settings, Get请求,无参数。

实列:http://192.168.1.74:9200/shopping/_settings/,查看elasticsearch 服务器上关于shopping 索引的相关信息。

截图:

4、查看多个索引

查看多个索引语法规则:http://elasticsearch 服务器访问地址/索引名称1,索引名称2.../_settings, Get请求,无参数。

实列:http://192.168.1.74:9200/shopping,security/_settings/,查看elasticsearch 服务器上关于shopping索引、security索引的相关信息。

截图:

5、删除索引

删除索引语法规则:http://elasticsearch 服务器访问地址/索引名称, Delete 请求, 无参数

实列:http://192.168.1.74:9200/blog/, elasticsearch 服务器关闭blog 索引。

截图:

6、禁止/启用 索引

禁用索引语法规则:http://elasticsearch 服务器访问地址/索引名称/_close, Post 请求, 无参数

实列:http://192.168.1.74:9200/shopping/_close/,elasticsearch 服务器关闭shopping 索引。

截图:

启用索引语法规则:http://elasticsearch 服务器访问地址/索引名称/_open, Post 请求, 无参数

实列:http://192.168.1.74:9200/shopping/_open/,elasticsearch 服务器重新开启shopping 索引。

截图:

声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号