ctx.execution_time.getMillis() no longer works with Elasticsearch 6.5.0

I have been using ctx.execution_time.getMillis() in painless script for my watcher and it has been working until 6.5.0. Here is the error from watcher execution:

    "type": "script_exception",
    "reason": "runtime error",
    "script_stack": [
      "fromTime = ctx.execution_time.getMillis() - toMillis(ctx.payload.monitor.period);\n    ",
      "                             ^---- HERE"
    ],
    "lang": "painless",
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "dynamic method [org.joda.time.DateTime, getMillis/0] not found"
    }

What is the new way to get the milliseconds from the ctx.execution_time if this is not a bug?

Thanks for reporting @tphongio. This is a bug. It is the result of https://github.com/elastic/elasticsearch/pull/33486. I will work on a fix.

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