# Managing Real-time and Batch Processing in Elasticsearch to Prevent Document Resurrection

**URL:** https://discuss.elastic.co/t/managing-real-time-and-batch-processing-in-elasticsearch-to-prevent-document-resurrection/345452
**Category:** Elasticsearch
**Created:** [October 20, 2023, 10:17am UTC](https://discuss.elastic.co/t/managing-real-time-and-batch-processing-in-elasticsearch-to-prevent-document-resurrection/345452 "2023-10-20T10:17:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![taichi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/taichi/32/46431_2.png) [@taichi](https://discuss.elastic.co/u/taichi)
#### Post date: [October 20, 2023, 10:17am UTC](https://discuss.elastic.co/t/managing-real-time-and-batch-processing-in-elasticsearch-to-prevent-document-resurrection/345452/1 "2023-10-20T10:17:41Z")

</div>

Hello,

I'm facing a challenge and need your expertise. In our system, we have a real-time process that adds or removes documents in an Elasticsearch index based on changes in an RDBMS. Alongside, we also have a batch process that periodically refreshes the entire index data.

Consider this scenario:

- At time `T1`, a real-time process detects a record deletion in the RDBMS and subsequently deletes the corresponding document from Elasticsearch.
- At time `T2`, our batch process, unaware of the recent change, brings in an older snapshot of data that still includes the previously deleted record, thus potentially "resurrecting" the document in Elasticsearch.

I hope this example clarifies the dilemma.

Are there any built-in mechanisms or best practices within Elasticsearch to handle such situations? Or would I be required to implement safeguards at the application level to ensure data integrity between the two processes?

Thank you in advance for your insights and suggestions!

---

<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: [November 17, 2023, 10:18am UTC](https://discuss.elastic.co/t/managing-real-time-and-batch-processing-in-elasticsearch-to-prevent-document-resurrection/345452/2 "2023-11-17T10:18:05Z")

</div>

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