I recently recieved some exceptions in my log while updating documents 
into my index.

org.elasticsearch.ElasticSearchIllegalArgumentException: TTL value must be 
> 0. Illegal value provided [-17810]
    at 
org.elasticsearch.action.index.IndexRequest.ttl(IndexRequest.java:291)
    at 
org.elasticsearch.action.update.UpdateHelper.prepare(UpdateHelper.java:153)
    at 
org.elasticsearch.action.update.UpdateHelper.prepare(UpdateHelper.java:60)
    at 
org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:183)
    at 
org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:179)
    at 
org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:63)
    at 
org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction$AsyncSingleAction$1.run(TransportInstanceSingleOperationAction.java:192)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)



I insert/update a lot of documents into Elasticsearch daily at 3:00 am by 
using an UPSERT command.
All of these documents (offers) have a TTL of 30 days (set using a template)

client.prepareUpdate(indexName, documentTypeName, offer.internal_id)
                                        .setDoc(offer)
                                        .setUpsert(newOffer)


I don't understand why I receive these errors. The expired documents 
*should already be removed* by elasticsearch right? Any help or pointers 
are much appreciated.

Questions:
1) I insert a document with a TTL of 30 days. I update this document daily. 
Will the TTL be reset to 30 days on every update or will it just decrease 
no matter what I do with the document.?
2) I found a similar topic 
https://groups.google.com/forum/#!msg/elasticsearch/ifvWZJjQuvU/cZzkhfmg6YoJ 
with Github issue 
https://github.com/elasticsearch/elasticsearch/issues/3256. This case 
describes a race condition while updating a document right after the TTL 
expired. In my case however documents are updated daily so expired document 
should already be removed right?
3) is there a way (e.g. a query) to tell what documents are about to expire 
/ or are expired and need to be removed by elasticsearch.
4) When query elasticsearch for document which have a TTL < 0 , it returns 
no documents. How come? This is the query I execute:

{
    "fields": ["_ttl"], 
    
   "query": {
        "match_all": {}
  },
  "filter": {
    "range": {
        "_ttl": {
            "lte": 1
            }
    }
  }
}


-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/5c671844-94ba-4be1-a94c-d6053f01d04a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to