# Delete is real-time or not?

**URL:** <https://discuss.elastic.co/t/delete-is-real-time-or-not/182290>\
**Category:** Elasticsearch\
**Created:** [May 22, 2019, 5:09pm UTC](https://discuss.elastic.co/t/delete-is-real-time-or-not/182290 "2019-05-22T17:09:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![artelk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/artelk/32/45644_2.png) [@artelk](https://discuss.elastic.co/u/artelk)\
**Post date:** [May 22, 2019, 5:09pm UTC](https://discuss.elastic.co/t/delete-is-real-time-or-not/182290/1 "2019-05-22T17:09:08Z")

</div>

Is it possible that after Delete operation executed the object can be still searchable (can be returned from Search and Get operations) for some period of time?

Delete operation has optional refresh parameter:  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html)  
Does it mean the Delete is not a real-time operation?

---

<div class="post-metadata">

**Author:** ![matheusribeirogarcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matheusribeirogarcia/32/44363_2.png) [@matheusribeirogarcia](https://discuss.elastic.co/u/matheusribeirogarcia)\
**Post date:** [May 22, 2019, 5:17pm UTC](https://discuss.elastic.co/t/delete-is-real-time-or-not/182290/2 "2019-05-22T17:17:11Z")

</div>

According to Elastic Documentation:

"Document changes are not visible to search immediately, but will become visible within 1 second. This is why we say that Elasticsearch has _near_ real-time search"

So technically, it is possible that after a delete, an object can be still searchable.

---

<div class="post-metadata">

**Author:** ![artelk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/artelk/32/45644_2.png) [@artelk](https://discuss.elastic.co/u/artelk)\
**Post date:** [May 22, 2019, 5:28pm UTC](https://discuss.elastic.co/t/delete-is-real-time-or-not/182290/3 "2019-05-22T17:28:54Z")

</div>

Can "Get" operation also return just deleted object?

---

<div class="post-metadata">

**Author:** ![matheusribeirogarcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matheusribeirogarcia/32/44363_2.png) [@matheusribeirogarcia](https://discuss.elastic.co/u/matheusribeirogarcia)\
**Post date:** [May 22, 2019, 5:34pm UTC](https://discuss.elastic.co/t/delete-is-real-time-or-not/182290/4 "2019-05-22T17:34:13Z")

</div>

I cannot awnser that for sure, but since the object is searchable, I don't see a reason why wouldn't it be able to get the document, if it was deleted in almost the same time the 'Get' was called.

I mean, isn't it almost the same thing? Only for different uses.

Edit: I've tried to do that, and it is possible to get a document after it was deleted, but it not really easy to do that.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 22, 2019, 5:41pm UTC](https://discuss.elastic.co/t/delete-is-real-time-or-not/182290/5 "2019-05-22T17:41:46Z")

</div>

Getting a document by id does not require a refresh so is real time. Any kind of search operation does require refresh.

---

<div class="post-metadata">

**Author:** ![artelk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/artelk/32/45644_2.png) [@artelk](https://discuss.elastic.co/u/artelk)\
**Post date:** [May 22, 2019, 6:00pm UTC](https://discuss.elastic.co/t/delete-is-real-time-or-not/182290/6 "2019-05-22T18:00:44Z")

</div>

Old discussion:

> [@Are objects searchable after updates?](https://discuss.elastic.co/t/are-objects-searchable-after-updates/98562):
>
> Imagine you have an object with a property X. The initial value of the property is 13. The object is searchable by a predicate "X \> 10". Someone modifies the property value to 42. Do we have guarantees that the object will be searchable by the same predicate after the update is sent to Elasticsearch? The used predicate matches both property values. As far as I know internally the updates are transformed to delete/insert pairs. Can it be possible that the query with the predicate "X \> 10" w…

So after the document is updated it disappeared from searches until the update is indexed.

As far as I understand the explanation is here:

> **[Get API | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html)**

From the "Versioning support":  
Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. The old version of the document doesn’t disappear immediately, although you won’t be able to access it. Elasticsearch cleans up deleted documents in the background as you continue to index more data.

I hoped after you deleted the document it is also "marked as old" and immediately disappeared from searches.

Could you please double check if delete really requires extra refresh to affect searches.

---

<div class="post-metadata">

**Author:** ![matheusribeirogarcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matheusribeirogarcia/32/44363_2.png) [@matheusribeirogarcia](https://discuss.elastic.co/u/matheusribeirogarcia)\
**Post date:** [May 22, 2019, 6:04pm UTC](https://discuss.elastic.co/t/delete-is-real-time-or-not/182290/7 "2019-05-22T18:04:12Z")

</div>

I mean, I wasn't able to do anything in that document, so it doesn't really matter

---

<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:** [June 19, 2019, 6:06pm UTC](https://discuss.elastic.co/t/delete-is-real-time-or-not/182290/8 "2019-06-19T18:06:05Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
