我希望手表能够在给定查询的文档数量介于特定值范围之间时发出警报。我创建了一个简单的文件脚本value_between.groovy来测试它。该脚本包含以下内容:
return ctx.payload.hits.total > lower_limit && ctx.payload.hits.total < upper_limit
我的观察条件如下:
"condition":
{
"script":
{
"file": "value_between",
"params":
{
"lower_limit": 50,
"upper_limit": 100
}
}
}
每次运行此监视时,都会失败,并显示以下日志消息。
[2016-10-12 13:22:27,285][ERROR][watcher.condition.script ] [elk-node] failed to execute [script] condition for [test-watch_174-2016-10-12T12:29:20.042Z]
ScriptException[failed to run file script [value_between] using lang [groovy]]; nested: MissingPropertyException[No such property: value for class: 5614867be4d02007620aca2099ecab8f6f899536];
非常感谢您的帮助!