Watch transform works in 6.3/6.4 but fails in 6.5

alerting

#1

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

(Alexander Reelsen) #2

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

--Alex


(Alexander Reelsen) #3

I opened https://github.com/elastic/elasticsearch/issues/35913 to track this.

Thanks for reporting!