# TTL not deleting documents

**URL:** <https://discuss.elastic.co/t/ttl-not-deleting-documents/34884>\
**Category:** Elasticsearch\
**Created:** [November 18, 2015, 7:05am UTC](https://discuss.elastic.co/t/ttl-not-deleting-documents/34884 "2015-11-18T07:05:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshafrnd4u](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@harshafrnd4u](https://discuss.elastic.co/u/harshafrnd4u)\
**Post date:** [November 18, 2015, 7:05am UTC](https://discuss.elastic.co/t/ttl-not-deleting-documents/34884/1 "2015-11-18T07:05:32Z")

</div>

Hi,

I am using logstash to push logs to elasticsearch. My mapping which was created automatically using template is

{  
"_default_": {  
"\_ttl": {  
"enabled": true,  
"default": 1296000000  
},  
"properties": {}  
},  
"keystone": {  
"\_ttl": {  
"enabled": true,  
"default": 1296000000  
},  
"properties": {  
"message": {  
"type": "string"  
},  
"@timestamp": {  
"format": "dateOptionalTime",  
"type": "date"  
},  
"level": {  
"type": "string"  
},  
"host": {  
"type": "string"  
},  
"path": {  
"type": "string"  
},  
"type": {  
"type": "string"  
},  
"@version": {  
"type": "string"  
}  
}  
}  
}

Its been more than 20 days but still documents are not deleted yet. Can anyone please help?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 18, 2015, 7:56am UTC](https://discuss.elastic.co/t/ttl-not-deleting-documents/34884/2 "2015-11-18T07:56:01Z")

</div>

Not sure what is happening but don't do that! It's super inefficient.

You'd better index in daily indices then remove indices older than 20 days. That's immediate.

Note that curator helps a lot doing that.

---

<div class="post-metadata">

**Author:** ![harshafrnd4u](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@harshafrnd4u](https://discuss.elastic.co/u/harshafrnd4u)\
**Post date:** [November 18, 2015, 9:45am UTC](https://discuss.elastic.co/t/ttl-not-deleting-documents/34884/3 "2015-11-18T09:45:05Z")

</div>

Sure David, I will write a cron job to delete old indices.

Thanks for the help

---

<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 5, 2017, 11:37pm UTC](https://discuss.elastic.co/t/ttl-not-deleting-documents/34884/4 "2017-07-05T23:37:42Z")

</div>


