Message: MissingPropertyException[No such property: red for class

I am new to watcher so I do a test with exemple from doc.
I have copied/pasted the exemple and I have an exception No such property: red for class
If I substitute the inline code with return true; it is OK at execution time but what's wrong with exemple provided by docuementation ?

[2017-06-21 15:08:27,784][ERROR][watcher.condition.script ] [node_CELIST0028] failed to execute [script] condition for [cluster_red_alert_19-2017-06-21T13:08:27.768Z]
ScriptException[failed to run inline script [if ( < 1) return false; def rows = ctx.payload.hits.hits; if (rows[0]._source.cluster_state.status != red) return false; if (ctx.payload.aggregations.minutes.buckets.size() < 12) return false; def last60Seconds = ctx.payload.aggregations.minutes.buckets[-12..-1]; return last60Seconds.every { it.status.buckets.every { s -> s.key == red }}] using lang [groovy]]; nested: MissingPropertyException[No such property: red for class: 1bb568efecae062d5e5deb7f3d122e79b25973c6];
at org.elasticsearch.script.groovy.GroovyScriptEngineService$

The documentation states that red is written in ticks, but it is not in your exception.

In addition you should make sure you use a newer version of Elasticsearch and Watcher, 2.3 is pretty old already.

If you upgrade to 5.0, watcher is part of the x-pack plugin.


thanks for your answer and now it is fixed

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