Skip to content

Watcher: Ensure upgrading from 6.x does not break watches checking for hit count #36115

@spinscale

Description

@spinscale

Many watches check the hit count in their condition (either a script condition or a compare condition) in order to determine if any documents have been returned.

As Elasticsearch 7.0 will not return hit counts by default, those watches would break silently on upgrade. We need to come up with a strategy to keep those watches running and/or properly notify the user that a new parameter is required.

A couple of common strategies:

  1. Always add the correct header to the search to return hit counts. Then no watch ever will profit from the speed up we have gained by disabling hit counts. This is fully BWC compatible
  2. Use the Upgrade API to check the conditions (the main condition plus all the action conditions) if there is a mention of hits.total, and if that is the case, change the search inputs to include that parameter. Then we can run the upgrade API before upgrading and thus change each watch accordingly. Note that this means, checking all the nested actions in chained actions as well.

Also, it might make sense to spill a useful error message, if a user is missing this parameter but specifies hits.total in a watch, to ease the switch from 6.0 to 7.0 - otherwise the user will only notice this new behaviour when checking the watch history or running the execute watch API.

/cc @jakelandis

Relates #36008 #36035 #35849

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions