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

    A query that filters the watches to be returned.

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

    One or more fields used to sort the search results.

    One of:

    One or more fields used to sort the search results.

    One or more fields used to sort the search results.

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

    Retrieve the next page of hits using a set of sort values from the previous page.

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
        • last_checked
        • last_met_condition
        • state object Required
        • 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
        • condition object Required
        • input object Required
        • metadata object
        • status object
        • 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.

        • transform object
        • trigger object Required
      • _primary_term number
      • _seq_no number
POST /_watcher/_query/watches
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"
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
      }
  ]
}