Hi, im getting this error when I test my watch
parse_exception :
"reason" : "please wrap watch including field [trigger] inside a "watch" field"
the alerts are sended to microsoft teams
this is my watch:
PUT _watcher/watch/my_watch/_execute
{
"trigger": {
"schedule": {
"interval": "5m"
}
},
"input": {
"search": {
"request": {
"body": {
"size": 0,
"query": {
"bool": {
"filter": {
"range": {
"@timestamp": {
"gte": "{{ctx.trigger.scheduled_time}}||-5m",
"lte": "{{ctx.trigger.scheduled_time}}",
"format": "strict_date_optional_time||epoch_millis"
}
}
}
}
}
},
"indices": [
"metrics-*"
]
}
}
},
"condition": {
"script": {
"source": "if (ctx.payload.hits.total <= params.threshold) { return true; } return false;",
"params": {
"threshold": 0
}
}
},
"transform": {
"script": {
"source": "HashMap result = new HashMap(); result.result = ctx.payload.hits.total; return result;",
"lang": "painless",
"params": {
"threshold": 0
}
}
},
"actions": {
"webhook_teams": {
"webhook": {
"scheme": "https",
"host": "outlook.office.com",
"port": 443,
"method": "post",
"path": "/webhook/...",
"params": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{{#toJson}}ctx.payload{{/toJson}}"
}
}
}
}
I have it working in another older version of elastic, 7.5.1.....in version 7.6 doesnt work
Any suggestions?