-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Monitoring creates watches for its Cluster Alerts feature. The definitions for these watches can be found in this folder: https://github.com/elastic/elasticsearch/tree/master/x-pack/plugin/monitoring/src/main/resources/monitoring/watches.
Some of these watches rely on hits.total being a scalar value. For example:
Line 132 in 1aa10c4
| "source": "ctx.vars.fails_check = ctx.payload.check.hits.total != 0 && ctx.payload.check.hits.hits[0]._source.cluster_state.status != 'green';ctx.vars.not_resolved = ctx.payload.alert.hits.total == 1 && ctx.payload.alert.hits.hits[0]._source.resolved_timestamp == null;return ctx.vars.fails_check || ctx.vars.not_resolved" |
Starting 7.0, Elasticsearch will default to hits.total being an object instead of a scalar value. To account for this, two sets of fixes ought to be made to the Cluster Alerts watches:
-
In the
6.7branch, these watches should includerest_total_hits_as_intin theirsearchqueries. This will allow a Cluster Alert watch created by a6.7cluster to function properly either on a6.7or7.0monitoring cluster. -
In the
7.0,7.x, andmasterbranches, these watches should be updated so any references tohits.totalrefer tohits.total.valueinstead.