-
Notifications
You must be signed in to change notification settings - Fork 181
Closed
Labels
Team:ExperienceIssues owned by the Experience Docs TeamIssues owned by the Experience Docs Teamcommunitysource:webIssues originating from the elastic.co docsIssues originating from the elastic.co docs
Description
Type of issue
Other
What documentation page is affected
https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher/input-http#_using_templates_2
What happened?
The value {{ctx.trigger.triggered_time}}||-5m of from in body does not work. {{ctx.trigger.triggered_time}} returns a string and cannot do the time math.
This happens because date math expressions only work in specific Elasticsearch contexts (like index names and date range queries), not in arbitrary mustache template positions.
To solve this i had to create a Transform Script.
{
"transform": {
"script": {
"source": "ctx.payload.calculated_time = ZonedDateTime.parse(ctx.trigger.triggered_time).minusMinutes(5)",
"lang": "painless"
}
}
}
Additional info
No response
Metadata
Metadata
Assignees
Labels
Team:ExperienceIssues owned by the Experience Docs TeamIssues owned by the Experience Docs Teamcommunitysource:webIssues originating from the elastic.co docsIssues originating from the elastic.co docs