Query watches Generally available; Added in 7.11.0

POST /_watcher/_query/watches

All methods and paths for this operation:

GET /_watcher/_query/watches

POST /_watcher/_query/watches

Get all registered watches in a paginated manner and optionally filter watches by a query.

Note that only the _id and metadata.* fields are queryable or sortable.

Required authorization

  • Cluster privileges: monitor_watcher
application/json

Body

  • from number

    The offset from the first result to fetch. It must be non-negative.

    Default value is 0.

  • size number

    The number of hits to return. It must be non-negative.

    Default value is 10.

  • query object

    An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

    External documentation
  • sort string | object | array[string | object]

    One of:

    Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

    One of:

    Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

  • search_after array[number | string | boolean | null | object]

    A field value.

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • count number Required

      The total number of watches found.

    • watches array[object] Required

      A list of watches based on the from, size, or search_after request body parameters.

      Hide watches attributes Show watches attributes object
      • _id string Required
      • status object
        Hide status attributes Show status attributes object
        • actions object Required
          Hide actions attribute Show actions attribute object
          • * object Additional properties
            Hide * attributes Show * attributes object
            • ack object Required
            • last_execution object
            • last_successful_execution object
            • last_throttle object
        • last_checked string | number

          A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.

          One of:

          Time unit for milliseconds

        • last_met_condition string | number

          A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.

          One of:

          Time unit for milliseconds

        • state object Required
          Hide state attributes Show state attributes object
          • active boolean Required
          • timestamp string
        • version number Required
        • execution_state string
      • watch object
        Hide watch attributes Show watch attributes object
        • actions object Required
          Hide actions attribute Show actions attribute object
          • * object Additional properties
            Hide * attributes Show * attributes object
            • action_type string

              Values are email, webhook, index, logging, slack, or pagerduty.

            • condition object
            • foreach string
            • max_iterations number
            • name string
            • throttle_period string

              A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

            • throttle_period_in_millis
            • transform object
            • index object
            • logging object
            • email
            • pagerduty
            • slack object
            • webhook
        • condition object Required
          Hide condition attributes Show condition attributes object
          • always object
          • array_compare object
            Hide array_compare attribute Show array_compare attribute object
            • * object Additional properties
          • compare object
            Hide compare attribute Show compare attribute object
            • * object Additional properties
          • never object
          • script object
            Hide script attributes Show script attributes object
            • lang string

              Default value is painless.

            • params object
            • source string
            • id string
        • input object Required
          Hide input attributes Show input attributes object
          • chain object
            Hide chain attribute Show chain attribute object
            • inputs array[object] Required
          • http object
            Hide http attributes Show http attributes object
            • extract array[string]
            • request object
            • response_content_type string

              Values are json, yaml, or text.

          • simple object
            Hide simple attribute Show simple attribute object
            • * object Additional properties
        • metadata object
          Hide metadata attribute Show metadata attribute object
          • * object Additional properties
        • status object
          Hide status attributes Show status attributes object
          • actions object Required
            Hide actions attribute Show actions attribute object
            • * object Additional properties
          • last_checked string
          • last_met_condition string
          • state object Required
            Hide state attributes Show state attributes object
            • active boolean Required
            • timestamp
          • version number Required
          • execution_state string
        • throttle_period string

          A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

        • throttle_period_in_millis number

          Time unit for milliseconds

        • transform object
          Hide transform attributes Show transform attributes object
          • chain array[object]
          • script object
            Hide script attributes Show script attributes object
            • lang string

              Default value is painless.

            • params object
            • source string
            • id string
        • trigger object Required
          Hide trigger attribute Show trigger attribute object
          • schedule object
            Hide schedule attributes Show schedule attributes object
            • timezone string
            • cron string
            • daily object
            • hourly object
            • interval string

              A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

            • monthly
            • weekly
            • yearly
      • _primary_term number
      • _seq_no number
GET /_watcher/_query/watches 
resp = client.watcher.query_watches()
const response = await client.watcher.queryWatches();
response = client.watcher.query_watches
$resp = $client->watcher()->queryWatches();
curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/_query/watches"
client.watcher().queryWatches(); 
Response examples (200)
A successful response from `GET /_watcher/_query/watches`.
{ "count": 1, "watches": [ { "_id": "my_watch", "watch": { "trigger": { "schedule": { "hourly": { "minute": [ 0, 5 ] } } }, "input": { "simple": { "payload": { "send": "yes" } } }, "condition": { "always": {} }, "actions": { "test_index": { "index": { "index": "test" } } } }, "status": { "state": { "active": true, "timestamp": "2015-05-26T18:21:08.630Z" }, "actions": { "test_index": { "ack": { "timestamp": "2015-05-26T18:21:08.630Z", "state": "awaits_successful_execution" } } }, "version": -1 }, "_seq_no": 0, "_primary_term": 1 } ] }