When an alerting rule finishes running, it updates select fields within the rule saved-object to reflect the new timestamp it last run, the success/failure outcome, etc. The saved-object update method recently got changed to support downward-compatible updates (https://github.com/elastic/kibana/issues/152807) by performing a get + Kibana side update before calling index. These extra requests when running many rules add extra latency and I/O to Elasticsearch that we do not need to perform when updating rules at the end of their execution.
Definition of Done
[x] Rules update themselves after a run by using the Elasticsearch client directly instead of the saved-objects client
[x] Only the necessary fields are passed to the update function to perform a partial update
[ ] Preferably, other code using the partiallyUpdateRule function also leverage benefits from this work
When an alerting rule finishes running, it updates select fields within the rule saved-object to reflect the new timestamp it last run, the success/failure outcome, etc. The saved-object update method recently got changed to support downward-compatible updates (https://github.com/elastic/kibana/issues/152807) by performing a get + Kibana side update before calling
index
. These extra requests when running many rules add extra latency and I/O to Elasticsearch that we do not need to perform when updating rules at the end of their execution.Definition of Done
partiallyUpdateRule
function also leverage benefits from this work