我正在尝试从 AWS ElasticSearchService Monitor Alert Trigger 在 Slack 上发布详细消息。我尝试使用描述中的变量 https://opendistro.github.io/for-elasticsearch-docs/docs/alerting/monitors/
警报被触发并发布在 Slack 上,但是当我尝试在行动中使用它们时,大多数变量都是空的。我只从ctx.trigger.name
, ctx.periodStart
,获取信息ctx.periodEnd
。ctx.trigger.condition
像, ctx.results[0]
, ctx.error
,这样的变量ctx.results[0].hits.total
是空的,而文档说如果是空的ctx.error
将被填充。ctx.results[0]
如何获取更多数据?我的查询是否以某种方式限制了它?
我的监视器提取查询如下:
{
"size": 20,
"query": {
"constant_score": {
"filter": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"from": "now-1m",
"to": null,
"include_lower": true,
"include_upper": true,
"boost": 1
}
}
}
],
"must_not": [
{
"match": {
"status": {
"query": "200",
"operator": "OR",
"prefix_length": 0,
"max_expansions": 50,
"fuzzy_transpositions": true,
"lenient": false,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"boost": 1
}
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"boost": 1
}
}
}