# Watch transform works in 6.3/6.4 but fails in 6.5

**URL:** <https://discuss.elastic.co/t/watch-transform-works-in-6-3-6-4-but-fails-in-6-5/157494>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [November 20, 2018, 8:31am UTC](https://discuss.elastic.co/t/watch-transform-works-in-6-3-6-4-but-fails-in-6-5/157494 "2018-11-20T08:31:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakn](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@jakn](https://discuss.elastic.co/u/jakn)\
**Post date:** [November 20, 2018, 8:31am UTC](https://discuss.elastic.co/t/watch-transform-works-in-6-3-6-4-but-fails-in-6-5/157494/1 "2018-11-20T08:31:44Z")

</div>

This watcher code works in 6.3 and 6.4, but not in 6.5 where it results in a "failed to execute watch transform" error.

Why?  
What should it look like to work in 6.5?

```
POST _xpack/watcher/watch/_execute
{
  "watch":{
  "trigger": {
    "schedule": {
        "interval": "10s"
      }
  },
  "input": {
    "none": {}
  },
  "actions": {
    "email_admin": {
      "email": {
        "profile": "standard",
        "to": [
          "email@domain.com"
        ],
        "subject": "{{ctx.watch_id}} executed",
        "body": {
          "text": "{{ctx.watch_id}} processing information \n\nScheduled time \n{{ctx.trigger.scheduled_time}} = {{ctx.payload.time_scheduled}} "
        }
      }
    }
  },
  "transform": {
    "script": {
      "source": "return ['time_scheduled': Instant.ofEpochMilli(ctx.trigger.scheduled_time.getMillis()).atZone(ZoneId.of('Europe/Copenhagen')).format(DateTimeFormatter.ofPattern('YYYY-MM-dd HH:mm:ss'))]",
      "lang": "painless"
   }
  }
 }
}
```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 26, 2018, 4:32pm UTC](https://discuss.elastic.co/t/watch-transform-works-in-6-3-6-4-but-fails-in-6-5/157494/2 "2018-11-26T16:32:39Z")

</div>

this looks like a bug upon first inspection. I'll take a look and get back to you!

--Alex

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 26, 2018, 4:41pm UTC](https://discuss.elastic.co/t/watch-transform-works-in-6-3-6-4-but-fails-in-6-5/157494/3 "2018-11-26T16:41:11Z")

</div>

I opened [https://github.com/elastic/elasticsearch/issues/35913](https://github.com/elastic/elasticsearch/issues/35913) to track this.

Thanks for reporting!

---

<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 24, 2018, 4:41pm UTC](https://discuss.elastic.co/t/watch-transform-works-in-6-3-6-4-but-fails-in-6-5/157494/4 "2018-12-24T16:41:16Z")

</div>

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