Thursday, May 18, 2017

elasticsearch update_by_query

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html#picking-up-a-new-property

This is helpful when you want to update a bunch of documents.

This works for me

The inline script does not work for me.
Always got this error
{
  "error": {
    "root_cause": [
      {
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
          "ctx._soruce.date=\"2017-05-18T05:35:23.103Z\";",
          "           ^---- HERE"
        ],
        "script": "ctx._soruce.date=\"2017-05-18T05:35:23.103Z\";",
        "lang": "painless"
      }
    ],
    "type": "script_exception",
    "reason": "runtime error",
    "caused_by": {
      "type": "null_pointer_exception",
      "reason": null
    },
    "script_stack": [
      "ctx._soruce.date=\"2017-05-18T05:35:23.103Z\";",
      "           ^---- HERE"
    ],
    "script": "ctx._soruce.date=\"2017-05-18T05:35:23.103Z\";",
    "lang": "painless"
  },
  "status": 500
}
For single document update, the inline script works

No comments:

Post a Comment