# Renew \_ttl on an already expired document

**URL:** <https://discuss.elastic.co/t/renew--ttl-on-an-already-expired-document/26138>\
**Category:** Elasticsearch\
**Created:** [July 23, 2015, 8:45am UTC](https://discuss.elastic.co/t/renew--ttl-on-an-already-expired-document/26138 "2015-07-23T08:45:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Bolis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_bolis/32/700_2.png) [@Thomas\_Bolis](https://discuss.elastic.co/u/Thomas_Bolis)\
**Post date:** [July 23, 2015, 8:45am UTC](https://discuss.elastic.co/t/renew--ttl-on-an-already-expired-document/26138/1 "2015-07-23T08:45:35Z")

</div>

Hi,

I'm trying to renew a document's ttl (via a script) in order not to get expired. There are cases where the document is already marked for expiration but it has not yet deleted.

So in this case I get the following error:

```
org.elasticsearch.index.mapper.MapperParsingException: failed to parse [_ttl]
    at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:411)
    at org.elasticsearch.index.mapper.internal.TTLFieldMapper.postParse(TTLFieldMapper.java:174)
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:552)
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:493)
    at org.elasticsearch.index.shard.IndexShard.prepareIndex(IndexShard.java:493)
    at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:192)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase.performOnPrimary(TransportShardReplicationOperationAction.java:574)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase.routeRequestOrPerformLocally(TransportShardReplicationOperationAction.java:444)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase.doRun(TransportShardReplicationOperationAction.java:370)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:36)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction.doExecute(TransportShardReplicationOperationAction.java:112)
    at org.elasticsearch.action.index.TransportIndexAction.innerExecute(TransportIndexAction.java:136)
    at org.elasticsearch.action.index.TransportIndexAction.doExecute(TransportIndexAction.java:114)
    at org.elasticsearch.action.index.TransportIndexAction.doExecute(TransportIndexAction.java:63)
    at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:75)
    at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:217)
    at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:170)
    at org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction$AsyncSingleAction$1.run(TransportInstanceSingleOperationAction.java:187)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
  Caused by: org.elasticsearch.index.AlreadyExpiredException: already expired [my_index]/[my_type]/[AU62OunMJpm4BthfuL_1] due to expire at [1437576451116] and was processed at [1437576461112]
    at org.elasticsearch.index.mapper.internal.TTLFieldMapper.innerParseCreateField(TTLFieldMapper.java:212)
    at org.elasticsearch.index.mapper.core.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:239)
    at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:401)
    ... 20 more

```

I know that I can put a larger ttl and renew the ttl of the document more often and this case will be avoided, but my question is if there is any more preferable way to refresh a document in order to prevent it from being expired?

I have noticed about bug: [#8715](https://github.com/elastic/elasticsearch/pull/8715). Is it by somehow related and will it fix the problem? I do perform a scripted update. This fix is marked for version 2.0.0 so it will come with version 2 of elasticsearch?

I have as well posted the same question in stackoverflow [here](http://stackoverflow.com/questions/31566693/renew-ttl-on-an-already-expired-document?noredirect=1#comment51097602_31566693)

Thank you

---

<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:59pm UTC](https://discuss.elastic.co/t/renew--ttl-on-an-already-expired-document/26138/2 "2017-07-05T23:59:38Z")

</div>


