# TTL and Recovery

**URL:** <https://discuss.elastic.co/t/ttl-and-recovery/13668>\
**Category:** Elasticsearch\
**Created:** [September 18, 2013, 10:39am UTC](https://discuss.elastic.co/t/ttl-and-recovery/13668 "2013-09-18T10:39:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan\_Hendrik\_Lendholt](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jan\_Hendrik\_Lendholt](https://discuss.elastic.co/u/Jan_Hendrik_Lendholt)\
**Post date:** [September 18, 2013, 10:39am UTC](https://discuss.elastic.co/t/ttl-and-recovery/13668/1 "2013-09-18T10:39:08Z")

</div>

Hi there,

just a short question:

When I have an index with documnets and the \_ttl set, and ES has been shut  
down, and gets started again, the documents that have expired in the  
meantime gets purged.

Where exactly in the source code happens this? I was searching for ages but  
all I could find was the IndicesTTLService.java file but that one does not  
seem to be the right place.  
I suppose it happens somewhere in the recovery process.

I tried to figure out by setting log level to trace but that did not give  
me the right place either.

As always, any help is appreciated.

Thanks,

Jan

--  
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:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [September 20, 2013, 8:21am UTC](https://discuss.elastic.co/t/ttl-and-recovery/13668/2 "2013-09-20T08:21:02Z")

</div>

Once a node starts, the IndicesTTLService is also started. The  
IndicesTTLService  
starts the PurgerThread thread that periodically deletes all expired  
document for all indices that have a ttl configured. The deleting is  
actually performed in the PurgerThread#purgeShards method.

If you set the 'indices.ttl' to 'DEBUG' in the logging.yml, you should see  
the related log lines.

On 18 September 2013 12:39, Jan-Hendrik Lendholt [jan.lendholt@gmail.com](mailto:jan.lendholt@gmail.com)wrote:

> Hi there,
> 
> just a short question:
> 
> When I have an index with documnets and the \_ttl set, and ES has been shut  
> down, and gets started again, the documents that have expired in the  
> meantime gets purged.
> 
> Where exactly in the source code happens this? I was searching for ages  
> but all I could find was the IndicesTTLService.java file but that one  
> does not seem to be the right place.  
> I suppose it happens somewhere in the recovery process.
> 
> I tried to figure out by setting log level to trace but that did not give  
> me the right place either.
> 
> As always, any help is appreciated.
> 
> Thanks,
> 
> Jan
> 
> --  
> 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).

--  
Met vriendelijke groet,

Martijn van Groningen

--  
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:15am UTC](https://discuss.elastic.co/t/ttl-and-recovery/13668/3 "2017-07-06T02:15:25Z")

</div>

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


