# How to disable TTL feature for index after it has been enabled?

**URL:** <https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012>\
**Category:** Elasticsearch\
**Created:** [March 15, 2012, 10:25am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012 "2012-03-15T10:25:56Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Peuss](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@Thomas\_Peuss](https://discuss.elastic.co/u/Thomas_Peuss)\
**Post date:** [March 15, 2012, 10:25am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/1 "2012-03-15T10:25:56Z")

</div>

Hi!

We have enabled the TTL feature for some of our indices. This works like a  
charm. But we want to disable this feature for one of our indices  
temporaryly. I tried with

curl -v -XPUT '[http://localhost:9200/machineindex/logs/\_mapping](http://localhost:9200/machineindex/logs/_mapping)' -d '  
{  
"logs": {  
"\_ttl": {  
"enabled": false  
}  
}  
}  
'

Response is: {"ok":true,"acknowledged":true}

When I check back with curl -XGET  
'[http://localhost:9200/machineindex/logs/\_mapping?pretty=true](http://localhost:9200/machineindex/logs/_mapping?pretty=true)' it is still  
shown as "enabled":true.

Any idea?

CU  
Thomas

---

<div class="post-metadata">

**Author:** ![Benjamin\_Deveze](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benjamin_deveze/32/1577_2.png) [@Benjamin\_Deveze](https://discuss.elastic.co/u/Benjamin_Deveze)\
**Post date:** [March 15, 2012, 10:46am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/2 "2012-03-15T10:46:41Z")

</div>

Hey Thomas,

what exactly do you want to achieve by disabling TTL? Do you mean you want  
to suspend the purge process of expired documents temporarily for a  
specific index? Or is it that you have a default TTL value set for this  
index and you want that temporarily all new indexed docs come with no TTL?  
Or is it something else?

---

<div class="post-metadata">

**Author:** ![Thomas\_Peuss](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@Thomas\_Peuss](https://discuss.elastic.co/u/Thomas_Peuss)\
**Post date:** [March 15, 2012, 11:35am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/3 "2012-03-15T11:35:52Z")

</div>

Hi Benjamin!

Am Donnerstag, 15. März 2012 11:46:41 UTC+1 schrieb Benjamin Devèze:

> what exactly do you want to achieve by disabling TTL? Do you mean you want  
> to suspend the purge process of expired documents temporarily for a  
> specific index? Or is it that you have a default TTL value set for this  
> index and you want that temporarily all new indexed docs come with no TTL?  
> Or is it something else?

We want to suspend the purge process. I know that we can set the purge  
interval. As far as I know this is a global setting. We only want to  
disable it for one index.

CU  
Thomas

---

<div class="post-metadata">

**Author:** ![Benjamin\_Deveze](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benjamin_deveze/32/1577_2.png) [@Benjamin\_Deveze](https://discuss.elastic.co/u/Benjamin_Deveze)\
**Post date:** [March 15, 2012, 11:58am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/4 "2012-03-15T11:58:48Z")

</div>

Ok I understand your problem and reading the code of IndicesTTLService it  
is clearer why you try to disable the TTL field for your specific index so  
that it won't be candidate for the purge. Disabling temporarily the TTL  
field to disable purge temporarily won't be a great idea because if you  
still index docs with TTL the TTL of these docs won't be set. Purge  
interval could have helped but I think you are right it is a global setting  
and it is not that great to temporarily disable the purge because if you  
set it to 24h for example and just after you want to reenable it I am  
afraid you will have to wait 24h for the next purge...

I think we should add a global setting to just disable, enable purger and  
also a per index setting to do the same.

Kimchy any thoughts on this? If you are ok with that I can open an issue  
and implement it.

Thomas for your immediate problem I'm afraid there is not really a  
solution...

On Thursday, March 15, 2012 12:35:52 PM UTC+1, Thomas Peuss wrote:

> Hi Benjamin!
> 
> Am Donnerstag, 15. März 2012 11:46:41 UTC+1 schrieb Benjamin Devèze:
> 
> > what exactly do you want to achieve by disabling TTL? Do you mean you  
> > want to suspend the purge process of expired documents temporarily for a  
> > specific index? Or is it that you have a default TTL value set for this  
> > index and you want that temporarily all new indexed docs come with no TTL?  
> > Or is it something else?
> 
> We want to suspend the purge process. I know that we can set the purge  
> interval. As far as I know this is a global setting. We only want to  
> disable it for one index.
> 
> CU  
> Thomas

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 17, 2012, 9:49am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/5 "2012-03-17T09:49:38Z")

</div>

Yea, we can add a feature of a setting (on the index level) that allows to  
disable or enable purging of ttl'ed docs.

On Thu, Mar 15, 2012 at 1:58 PM, Benjamin Devèze  
[benjamin.deveze@gmail.com](mailto:benjamin.deveze@gmail.com)wrote:

> Ok I understand your problem and reading the code of IndicesTTLService it  
> is clearer why you try to disable the TTL field for your specific index so  
> that it won't be candidate for the purge. Disabling temporarily the TTL  
> field to disable purge temporarily won't be a great idea because if you  
> still index docs with TTL the TTL of these docs won't be set. Purge  
> interval could have helped but I think you are right it is a global setting  
> and it is not that great to temporarily disable the purge because if you  
> set it to 24h for example and just after you want to reenable it I am  
> afraid you will have to wait 24h for the next purge...
> 
> I think we should add a global setting to just disable, enable purger and  
> also a per index setting to do the same.
> 
> Kimchy any thoughts on this? If you are ok with that I can open an issue  
> and implement it.
> 
> Thomas for your immediate problem I'm afraid there is not really a  
> solution...
> 
> On Thursday, March 15, 2012 12:35:52 PM UTC+1, Thomas Peuss wrote:
> 
> > Hi Benjamin!
> > 
> > Am Donnerstag, 15. März 2012 11:46:41 UTC+1 schrieb Benjamin Devèze:
> > 
> > > what exactly do you want to achieve by disabling TTL? Do you mean you  
> > > want to suspend the purge process of expired documents temporarily for a  
> > > specific index? Or is it that you have a default TTL value set for this  
> > > index and you want that temporarily all new indexed docs come with no TTL?  
> > > Or is it something else?
> > 
> > We want to suspend the purge process. I know that we can set the purge  
> > interval. As far as I know this is a global setting. We only want to  
> > disable it for one index.
> > 
> > CU  
> > Thomas

---

<div class="post-metadata">

**Author:** ![Benjamin\_Deveze](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benjamin_deveze/32/1577_2.png) [@Benjamin\_Deveze](https://discuss.elastic.co/u/Benjamin_Deveze)\
**Post date:** [March 17, 2012, 10:47am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/6 "2012-03-17T10:47:15Z")

</div>

ok an issue has been opened for it  
here [https://github.com/elasticsearch/elasticsearch/issues/1791](https://github.com/elasticsearch/elasticsearch/issues/1791)

---

<div class="post-metadata">

**Author:** ![Thomas\_Peuss](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@Thomas\_Peuss](https://discuss.elastic.co/u/Thomas_Peuss)\
**Post date:** [March 20, 2012, 8:29am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/7 "2012-03-20T08:29:09Z")

</div>

Hello Benjamin!

Am Samstag, 17. März 2012 11:47:15 UTC+1 schrieb Benjamin Devèze:

> ok an issue has been opened for it here  
> [Add an index level setting to disable/enable purging of expired docs · Issue #1791 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1791)

Thank you!

CU  
Thomas

---

<div class="post-metadata">

**Author:** ![Benjamin\_Deveze](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benjamin_deveze/32/1577_2.png) [@Benjamin\_Deveze](https://discuss.elastic.co/u/Benjamin_Deveze)\
**Post date:** [March 23, 2012, 9:54am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/8 "2012-03-23T09:54:32Z")

</div>

Just to let you know that the feature has been pushed. You have now in  
master and will have in next released ES versions a new index setting named  
"index.ttl.disable\_purge" to do what you needed.

Thanks for the suggestion of this improvement.

On Tuesday, March 20, 2012 9:29:09 AM UTC+1, Thomas Peuss wrote:

> Hello Benjamin!
> 
> Am Samstag, 17. März 2012 11:47:15 UTC+1 schrieb Benjamin Devèze:
> 
> > ok an issue has been opened for it here  
> > [https://github.com/​elasticsearch/elasticsearch/​issues/1791](https://github.com/%E2%80%8Belasticsearch/elasticsearch/%E2%80%8Bissues/1791)[https://github.com/elasticsearch/elasticsearch/issues/1791](https://github.com/elasticsearch/elasticsearch/issues/1791)
> 
> Thank you!
> 
> CU  
> Thomas

---

<div class="post-metadata">

**Author:** ![Thomas\_Peuss](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@Thomas\_Peuss](https://discuss.elastic.co/u/Thomas_Peuss)\
**Post date:** [March 23, 2012, 11:39am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/9 "2012-03-23T11:39:31Z")

</div>

Hi Benjamin!

Am Freitag, 23. März 2012 10:54:32 UTC+1 schrieb Benjamin Devèze:

> Just to let you know that the feature has been pushed. You have now in  
> master and will have in next released ES versions a new index setting named  
> "index.ttl.disable\_purge" to do what you needed.

Thank you! I have a look at this!

CU  
Thomas

---

<div class="post-metadata">

**Author:** ![Rzulf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rzulf/32/1587_2.png) [@Rzulf](https://discuss.elastic.co/u/Rzulf)\
**Post date:** [January 18, 2013, 4:48pm UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/10 "2013-01-18T16:48:55Z")

</div>

Hi,

I have question about this response. why disabling ttl after it was enabled  
has no effect  
on [http://localhost:9200/machineindex/logs/\_mapping?pretty=true](http://localhost:9200/machineindex/logs/_mapping?pretty=true) ?? I want  
to disable ttl on new documents.

--  
Michał

W dniu czwartek, 15 marca 2012 11:25:56 UTC+1 użytkownik Thomas Peuss  
napisał:

> Hi!
> 
> We have enabled the TTL feature for some of our indices. This works like a  
> charm. But we want to disable this feature for one of our indices  
> temporaryly. I tried with
> 
> curl -v -XPUT '[http://localhost:9200/machineindex/logs/\_mapping](http://localhost:9200/machineindex/logs/_mapping)' -d '  
> {  
> "logs": {  
> "\_ttl": {  
> "enabled": false  
> }  
> }  
> }  
> '
> 
> Response is: {"ok":true,"acknowledged":true}
> 
> When I check back with curl -XGET '  
> [http://localhost:9200/machineindex/logs/\_mapping?pretty=true](http://localhost:9200/machineindex/logs/_mapping?pretty=true)' it is still  
> shown as "enabled":true.
> 
> Any idea?
> 
> CU  
> Thomas

--

---

<div class="post-metadata">

**Author:** ![Brian1](https://avatars.discourse-cdn.com/v4/letter/b/50afbb/32.png) [@Brian1](https://discuss.elastic.co/u/Brian1)\
**Post date:** [February 18, 2014, 1:40pm UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/11 "2014-02-18T13:40:54Z")

</div>

So did anyone ever have an answer as to why the TTL wasn't actually being  
disabled? I have a default TTL, but I have 1 index that I would like for  
new documents to not be given a TTL. This index already exists, I just  
want to disable the TTL so as new ones arrive they aren't given a TTL.

I have done exactly as the original poster here did, and when I do my GET  
the value still says it is enabled. I even tried closing the index first,  
then making the change. It always replies as if it accepted the command,  
but the value in the get shows it is still active.

On Friday, January 18, 2013 11:48:55 AM UTC-5, Michał wrote:

> Hi,
> 
> I have question about this response. why disabling ttl after it was  
> enabled has no effect on  
> [http://localhost:9200/machineindex/logs/\_mapping?pretty=true](http://localhost:9200/machineindex/logs/_mapping?pretty=true) ?? I want to  
> disable ttl on new documents.
> 
> --  
> Michał
> 
> W dniu czwartek, 15 marca 2012 11:25:56 UTC+1 użytkownik Thomas Peuss  
> napisał:
> 
> > Hi!
> > 
> > We have enabled the TTL feature for some of our indices. This works like  
> > a charm. But we want to disable this feature for one of our indices  
> > temporaryly. I tried with
> > 
> > curl -v -XPUT '[http://localhost:9200/machineindex/logs/\_mapping](http://localhost:9200/machineindex/logs/_mapping)' -d '  
> > {  
> > "logs": {  
> > "\_ttl": {  
> > "enabled": false  
> > }  
> > }  
> > }  
> > '
> > 
> > Response is: {"ok":true,"acknowledged":true}
> > 
> > When I check back with curl -XGET '  
> > [http://localhost:9200/machineindex/logs/\_mapping?pretty=true](http://localhost:9200/machineindex/logs/_mapping?pretty=true)' it is  
> > still shown as "enabled":true.
> > 
> > Any idea?
> > 
> > CU  
> > Thomas

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/98f5d7de-cf40-4ef6-8e45-2a3198985856%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/98f5d7de-cf40-4ef6-8e45-2a3198985856%40googlegroups.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, 1:49am UTC](https://discuss.elastic.co/t/how-to-disable-ttl-feature-for-index-after-it-has-been-enabled/7012/12 "2017-07-06T01:49:28Z")

</div>


