我是靠谱客的博主 孝顺铃铛,最近开发中收集的这篇文章主要介绍Elasticsearch之CURL命令的DELETEElasticsearch之curl删除Elasticsearch之curl删除索引库,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

 

 

 

 

  也可以看我写的下面的博客

Elasticsearch之curl删除

Elasticsearch之curl删除索引库

 

 

 

 

 

 

   删除,某一条数据,如下

[hadoop@master elasticsearch-2.4.0]$ curl -XDELETE http://master:9200/zhouls/user/1
{"found":true,"_index":"zhouls","_type":"user","_id":"1","_version":4,"_shards":{"total":2,"successful":2,"failed":0}}[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$ 

 

 

  得到

 

 

 

  

 

 

   如果我们想要删除的文档存在,则found属性值为true,_version属性的值+1。

  如果我们想要删除的文档不存在,found属性值false,但是_version属性的值依然会+1,这个就是内部管理的一部分,它保证了我们在多个节点间的不同操作的顺序都被正确标记了。

  比如,如下,是我们在上面已经删除了的文档,可见,它依然还是+1。

[hadoop@master elasticsearch-2.4.0]$ curl -XDELETE http://master:9200/zhouls/user/1
{"found":true,"_index":"zhouls","_type":"user","_id":"1","_version":4,"_shards":{"total":2,"successful":2,"failed":0}}[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$ curl -XDELETE http://master:9200/zhouls/user/1
{"found":false,"_index":"zhouls","_type":"user","_id":"1","_version":1,"_shards":{"total":2,"successful":2,"failed":0}}[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$ curl -XDELETE http://master:9200/zhouls/user/1
{"found":false,"_index":"zhouls","_type":"user","_id":"1","_version":2,"_shards":{"total":2,"successful":2,"failed":0}}[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$ curl -XDELETE http://master:9200/zhouls/user/1
{"found":false,"_index":"zhouls","_type":"user","_id":"1","_version":3,"_shards":{"total":2,"successful":2,"failed":0}}[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$ curl -XDELETE http://master:9200/zhouls/user/1
{"found":false,"_index":"zhouls","_type":"user","_id":"1","_version":4,"_shards":{"total":2,"successful":2,"failed":0}}[hadoop@master elasticsearch-2.4.0]$
[hadoop@master elasticsearch-2.4.0]$ 

 

 

 

 

  注意:删除一个文档不会立即生效,它只是被标记成已删除。es将会在你之后添加更多索引的时候才会在后台进行删除内容的清理

 

 

 

 

 

 

 

官网

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html

 

最后

以上就是孝顺铃铛为你收集整理的Elasticsearch之CURL命令的DELETEElasticsearch之curl删除Elasticsearch之curl删除索引库的全部内容,希望文章能够帮你解决Elasticsearch之CURL命令的DELETEElasticsearch之curl删除Elasticsearch之curl删除索引库所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(37)

评论列表共有 0 条评论

立即
投稿
返回
顶部