美文网首页
三、入门操作

三、入门操作

作者: 金石_832e | 来源:发表于2021-05-23 17:27 被阅读0次
1、查看所有节点信息

http://192.168.64.128:9200/_cat/node

2、查看健康状态

http://192.168.64.128:9200/_cat/health

3、查看主节点

http://192.168.64.128:9200/_cat/master

4、查看所有索引

http://192.168.64.128:9200/_cat/indices

5、新增索引和文档(put请求)

http://192.168.64.128:9200/index1/person/1
新增index1索引,数据类型为person,文档位置的索引(id)为1

image.png
image.png
6、更新索引和文档(put请求)

http://192.168.64.128:9200/index1/person/1

image.png
如果是post请求,新增操作不需要带ID,如果带ID看是否存在该ID的数据,存在为更新,不存在该ID为新增
PUT请求必须带ID,不然报错,自己测试 image.png
image.png
7、查询文档

http://192.168.64.128:9200/index1/person/1

image.png
image.png
8、乐观锁修改文档

修改前需要知道乐观锁_seq_no的值
http://192.168.64.128:9200/index1/person/1?if_seq_no=2&if_primary_term=1

image.png
9、POST请求加_update更新文档

如果内容没有变化不做任何操作
这种更新方式会对比原来的数据

image.png
10、删除索引和删除文档

删除文档http://192.168.64.128:9200/index1/person/1

image.png
删除索引http://192.168.64.128:9200/index1
image.png
ES中没有提供类型删除的操作
批量操作
image.png

相关文章

网友评论

      本文标题:三、入门操作

      本文链接:https://www.haomeiwen.com/subject/emgajltx.html