# ctx.execution\_time.getMillis() no longer works with Elasticsearch 6.5.0

**URL:** <https://discuss.elastic.co/t/ctx-execution-time-getmillis-no-longer-works-with-elasticsearch-6-5-0/157788>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [November 21, 2018, 11:07pm UTC](https://discuss.elastic.co/t/ctx-execution-time-getmillis-no-longer-works-with-elasticsearch-6-5-0/157788 "2018-11-21T23:07:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tphongio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tphongio/32/37954_2.png) [@tphongio](https://discuss.elastic.co/u/tphongio)\
**Post date:** [November 21, 2018, 11:07pm UTC](https://discuss.elastic.co/t/ctx-execution-time-getmillis-no-longer-works-with-elasticsearch-6-5-0/157788/1 "2018-11-21T23:07:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [November 21, 2018, 11:41pm UTC](https://discuss.elastic.co/t/ctx-execution-time-getmillis-no-longer-works-with-elasticsearch-6-5-0/157788/2 "2018-11-21T23:41:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 19, 2018, 11:42pm UTC](https://discuss.elastic.co/t/ctx-execution-time-getmillis-no-longer-works-with-elasticsearch-6-5-0/157788/3 "2018-12-19T23:42:00Z")

</div>

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