Update of _ttl not working with doc option

201 views Asked by At

Hi I'm trying to update the ttl of a document with the following way but it seems that it is not getting updated:

POST /my_index/my_type/AU4Gd1DVbqjanfsolMgP/_update
{
"doc": {
"_ttl": 60000
},
"doc_as_upsert": true
}

With the script way it is getting updated normally.. What is the problem? does anyone know?

1

There are 1 answers

3
Andrei Stefan On

I think you can only update it through script. From the documentation:

It also allows to update the ttl of a document using ctx._ttl and timestamp using ctx._timestamp. Note that if the timestamp is not updated and not extracted from the _source it will be set to the update date.

In addition to _source, the following variables are available through the ctx map: _index, _type, _id, _version, _routing, _parent, _timestamp, _ttl.