# Handling document deletion

**URL:** <https://discuss.elastic.co/t/handling-document-deletion/13766>\
**Category:** Elasticsearch\
**Created:** [September 26, 2013, 2:12pm UTC](https://discuss.elastic.co/t/handling-document-deletion/13766 "2013-09-26T14:12:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bibin\_Abraham](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@Bibin\_Abraham](https://discuss.elastic.co/u/Bibin_Abraham)\
**Post date:** [September 26, 2013, 2:12pm UTC](https://discuss.elastic.co/t/handling-document-deletion/13766/1 "2013-09-26T14:12:51Z")

</div>

Hi,

My app's backend is MySQL. However, I am not using jdbc river as I want the  
search to be as realtime as possible. Can you confirm whether this method  
will work out in case of document deletion:

1. ttl will be enabled for each type
2. Since document deletion is expensive, when a new document is deleted, I  
will set the ttl for that document to the next weekend. In this way, all  
documents will be automatically deleted every week rather than at that  
particular time.
3. Searching will always filter documents on ttl

Because of FK constraint like ON DELETE CASCADE, multiple rows might get  
deleted in MySQL automatically. What is the best way to handle this type of  
scenario in ES? I was thinking about putting info about the related  
indexes+types in type.\_meta?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Bibin\_Abraham](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@Bibin\_Abraham](https://discuss.elastic.co/u/Bibin_Abraham)\
**Post date:** [September 30, 2013, 12:38pm UTC](https://discuss.elastic.co/t/handling-document-deletion/13766/2 "2013-09-30T12:38:37Z")

</div>

Please help

Regards

bin

On Thursday, 26 September 2013 19:42:51 UTC+5:30, bin wrote:

> Hi,
> 
> My app's backend is MySQL. However, I am not using jdbc river as I want  
> the search to be as realtime as possible. Can you confirm whether this  
> method will work out in case of document deletion:
> 
> 1. ttl will be enabled for each type
> 2. Since document deletion is expensive, when a new document is deleted, I  
> will set the ttl for that document to the next weekend. In this way, all  
> documents will be automatically deleted every week rather than at that  
> particular time.
> 3. Searching will always filter documents on ttl
> 
> Because of FK constraint like ON DELETE CASCADE, multiple rows might get  
> deleted in MySQL automatically. What is the best way to handle this type of  
> scenario in ES? I was thinking about putting info about the related  
> indexes+types in type.\_meta?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:14am UTC](https://discuss.elastic.co/t/handling-document-deletion/13766/3 "2017-07-06T02:14:15Z")

</div>

Closed on July 6, 2017, 2:14am UTC


