Update TTL of documents

(Carlos Vega Moreno) #1

My documentas have an specific ttl set and I would like to increase this ttl. Is there any fast way to do this for millions of documents?

I would like to avoid deletion and creation of the documents in order to update this field.
I tried using the update op type but it does not update the metadata even if I change the element before updating it. :neutral_face:


Carlos Vega

(David Pilato) #2

Updating a field will basically delete the document and reindex it.
There is no other way in elasticsearch.

BTW you should read: https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking_50_mapping_changes.html#_literal__timestamp_literal_and_literal__ttl_literal

(Carlos Vega Moreno) #3

Well, but it does not change the ttl even if I change the metadata of the document.
I'm not using elasticsearch 5.0 but 2.4

(David Pilato) #4

I never did that and I'm expecting it to work. May be it does not work with the update API though.
If you can provide a full example, may be someone can try it and check what is wrong.

About the 5.0 link I pasted earlier, I was just saying that you should prepare yourself to switch from internal TTL feature to the Delete By Query feature instead. Something you can start to do with 2.4. You will have then less efforts IMO to migrate to 5.0.

(system) #5