Prevent Elasticsearch from purging documents based on ttl


(Andreas Ries) #1

Hi,
I'm having trouble with restoring data from an elasticsearch database that contains documents with a ttl of 2 days.

A customer gave us the files forming the database. The documents in there are actually older than two days so that whenever I start elasicsearch, it does a good job on purging the documents.

My question is, how can I prevent elasticsearch from doing so, because I need to analyse the data.

I know, I could probably just change the operating system date/time but I thought there must be another way?
I already tried setting index.ttl.disable_purge : true in elasticsearch.yml, but that didn't work

Elasticsearch version is 2.2.0

Thanks,
Andi


(Zachary Tong) #2

disable_purge is a per-index setting, so you'll need to start Elasticsearch and then call an UpdateSettings API for the desired indices:

PUT /my_index/_settings
{
  "index.ttl.disable_purge": true
}

Alternatively, you could update the ttl interval to something very large so it doesn't run in the near future:

PUT /_cluster/settings
{
    "persistent" : {
        "indices.ttl.interval" : 999999999999
    }
}

Note: I think these are correct, but I'm going from memory since I haven't worked with 2.x in a long time :slight_smile:


(Andreas Ries) #3

Hi,

thanks for your answer, I'll give it a try.
But my guess is, that before I'm even able to make the PUT request, elasticsearch has already purged the documents right at startup.
I'll let you know


(Zachary Tong) #4

Yeah, I'm not sure how quickly the purge process boots up. You may have to resort to system time hacks :confused:


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.