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"
}
}
}
}