# Pre-delete TTL hook

**URL:** <https://discuss.elastic.co/t/pre-delete-ttl-hook/10403>\
**Category:** Elasticsearch\
**Created:** [January 18, 2013, 3:17am UTC](https://discuss.elastic.co/t/pre-delete-ttl-hook/10403 "2013-01-18T03:17:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [January 18, 2013, 3:17am UTC](https://discuss.elastic.co/t/pre-delete-ttl-hook/10403/1 "2013-01-18T03:17:46Z")

</div>

Hi,

Would it make sense to add a pre-delete hook to TTL functionality (  
[http://www.elasticsearch.org/guide/reference/mapping/ttl-field.html](http://www.elasticsearch.org/guide/reference/mapping/ttl-field.html) ) so  
that one can optionally do something with documents (e.g. archive them,  
compress them...) before they actually get deleted from the index?

## Thanks, Otis

Solr & ElasticSearch Support

> **[Sematext – Solr / Elasticsearch Experts – Search & Big Data Analytics](https://sematext.com/)**
>
> Building innovative Cloud and On Premise solutions for performance monitoring, alerting and anomaly detection (SPM), and log management and analytics (Logsene)

--

---

<div class="post-metadata">

**Author:** ![Edward\_Smit](https://avatars.discourse-cdn.com/v4/letter/e/46a35a/32.png) [@Edward\_Smit](https://discuss.elastic.co/u/Edward_Smit)\
**Post date:** [January 18, 2013, 4:58pm UTC](https://discuss.elastic.co/t/pre-delete-ttl-hook/10403/2 "2013-01-18T16:58:07Z")

</div>

Thanks for pointing out this future, I wasn't aware. I don't know if it  
makes much sense to have a pre-delete hook. TTL says it should be dead  
after the TTL, so why would you want to keep the dead documents.  
If this would be uses full then only for archiving purposes, compliancy  
scenario's come to mind, but I think I would rather keep the document in ES  
and make sure I filter out the results at query-time. An archive would be  
very hard to effectively use, without again loading it into another ES  
instance.  
My 2 cents

Op vrijdag 18 januari 2013 04:17:46 UTC+1 schreef Otis Gospodnetic het  
volgende:

> Hi,
> 
> Would it make sense to add a pre-delete hook to TTL functionality (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/ttl-field.html) ) so  
> that one can optionally do something with documents (e.g. archive them,  
> compress them...) before they actually get deleted from the index?
> 
> ## Thanks, Otis
> 
> Solr & Elasticsearch Support  
> [http://sematext.com/](http://sematext.com/)

--

---

<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:55am UTC](https://discuss.elastic.co/t/pre-delete-ttl-hook/10403/3 "2017-07-06T02:55:44Z")

</div>

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


