Elasticsearch Update by Query using CTX


(Adityo Setyonugroho) #1

I would like to update all documents inside the the index. I found that Update Query is the method we should use. But, I am facing problem when I am using ctx._now as a value for updated document's field, causing the field value become null.
This is the sample:

{
  "script": {
    "inline": "ctx._source.timenow = ctx._now"
  },
  "query": {
    "match_all": {}
  }
}

timenow

When I am using random number value, it is work. Let say that I put timenow = 5. Then, All documents field timenow become 5. But, it is not work using this ctx method.
How should I do that ?
Thank You


Elasticsearch Update by Query using CTX (2)
(system) #2

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