Watchers: moustache expressions syntax

alerting

#1

Hi again!

one more question regarding Watchers: I've been using such syntax for long time already:

 "range": {
  "modification": {
    "gte": "{{ctx.trigger.scheduled_time}}||-60m",
     "lte": null
  }
}

The variables are described here, but I've never seen documentation for that syntax: ||-60m . Why does the double pipe mean just "space" and not "OR", as one might think? :slight_smile:

Could you guy please point to the documentation for these operations?
Thank you!


(Ioannis Kakavas) #2

It's not clear why (as in what is the behavior you experience that justifies this ) you think this is a space and not a boolean OR, but it is a boolean OR operator as it is clearly documented in the painless docs

See below for the correct answer.


#3

oops, I always thought that such expression meant scheduled time MINUS 60 minutes, basically, I use it to check the events for the last hour :confused:
If the double pipe is just the "normal" OR operator, how should the expression above be read? If {{ctx.trigger.scheduled_time}} is not set, then use -60m?
Thanks!


(Alexander Reelsen) #4

@jetnet you are correct. This is indeed not painless , but the date math feature of Elasticsearch


#5

Great! Going to bookmark the link :slight_smile:
Thanks a lot again!


(Ioannis Kakavas) #6

Sorry for the confusion @jetnet and @spinscale . I totally misread this and spoke too quickly, glad you figured it out.


(system) #7

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