# Speculative deletes

**URL:** https://discuss.elastic.co/t/speculative-deletes/17959
**Category:** Elasticsearch
**Created:** [June 6, 2014, 5:03pm UTC](https://discuss.elastic.co/t/speculative-deletes/17959 "2014-06-06T17:03:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [June 6, 2014, 5:03pm UTC](https://discuss.elastic.co/t/speculative-deletes/17959/1 "2014-06-06T17:03:24Z")

</div>

I'm in the position where I need to make _sure_ a document is deleted from  
the index when something occurs in my source system. I want to just hit it  
with a DELETE every time. Is that a good idea?

It looks to me like DELETEing documents via ID is pretty cheap if the  
document doesn't exist. It looks like it sets some dirty flags but is  
otherwise pretty quick. My alternative is to do a GET and DELETE if it  
exists or, maybe, do something cute like:  
curl -XPOST 'localhost:9200/index/type/id/\_update' -d '{  
"script" : "ctx.op = "delete""  
}'  
which will short circuit that.

Thoughts?

Nik

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd3sit9WTgMV6qPb3WojV8-8aQt7VtwOHV6aP8q%2BMx32UQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd3sit9WTgMV6qPb3WojV8-8aQt7VtwOHV6aP8q%2BMx32UQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Itamar\_Syn\_Hershko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamar_syn_hershko/32/725_2.png) [@Itamar\_Syn\_Hershko](https://discuss.elastic.co/u/Itamar_Syn_Hershko)
#### Post date: [June 7, 2014, 6:20pm UTC](https://discuss.elastic.co/t/speculative-deletes/17959/2 "2014-06-07T18:20:32Z")

</div>

I'm pretty sure you're right  
On Jun 6, 2014 8:03 PM, "Nikolas Everett" [nik9000@gmail.com](mailto:nik9000@gmail.com) wrote:

> I'm in the position where I need to make _sure_ a document is deleted from  
> the index when something occurs in my source system. I want to just hit it  
> with a DELETE every time. Is that a good idea?
> 
> It looks to me like DELETEing documents via ID is pretty cheap if the  
> document doesn't exist. It looks like it sets some dirty flags but is  
> otherwise pretty quick. My alternative is to do a GET and DELETE if it  
> exists or, maybe, do something cute like:  
> curl -XPOST 'localhost:9200/index/type/id/\_update' -d '{  
> "script" : "ctx.op = "delete""  
> }'  
> which will short circuit that.
> 
> Thoughts?
> 
> Nik
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd3sit9WTgMV6qPb3WojV8-8aQt7VtwOHV6aP8q%2BMx32UQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd3sit9WTgMV6qPb3WojV8-8aQt7VtwOHV6aP8q%2BMx32UQ%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd3sit9WTgMV6qPb3WojV8-8aQt7VtwOHV6aP8q%2BMx32UQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd3sit9WTgMV6qPb3WojV8-8aQt7VtwOHV6aP8q%2BMx32UQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHTr4ZtWFDs7vxvS1r4QEBLgr44wPLVUawW%2BO\_63KSC\_tOjZfw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHTr4ZtWFDs7vxvS1r4QEBLgr44wPLVUawW%2BO_63KSC_tOjZfw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 1:24am UTC](https://discuss.elastic.co/t/speculative-deletes/17959/3 "2017-07-06T01:24:00Z")

</div>


