Doc_as_update and ttl


I want to upsert a document and at the same time reset it's TTL. I.e. To
do the upsert I use _update with doc_as_update true and to update the ttl I
use _update with script and ctx._ttl. It seems I can't do both of these at
the same time though. Does this mean I have to do one of:

  1. Two queries, one to upsert, the other to set ttl
  2. Write a script that upserts the doc from a parameter and updates the ttl

How would I go about doing 2. or do scripts only work on existing documents?

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
To view this discussion on the web visit
For more options, visit