Renew _ttl on an already expired document


(Thomas) #1

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. 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

Thank you


(system) #2