This documentation contains work-in-progress information for future Elastic Stack and Cloud releases. Use the version selector to view supported release docs. It also contains some Elastic Cloud serverless information. Check out our serverless docs for more details.
Get watch API
editGet watch API
editRetrieves a watch by its ID.
Request
editGET _watcher/watch/<watch_id>
Prerequisites
edit-
You must have
manage_watcher
ormonitor_watcher
cluster privileges to use this API. For more information, see Security privileges.
Path parameters
edit-
<watch_id>
- (Required, string) Identifier for the watch.
Examples
editThe following example gets a watch with my_watch
id:
resp = client.watcher.get_watch( id="my_watch", ) print(resp)
const response = await client.watcher.getWatch({ id: "my_watch", }); console.log(response);
GET _watcher/watch/my_watch
Response:
{ "found": true, "_id": "my_watch", "_seq_no": 0, "_primary_term": 1, "_version": 1, "status": { "version": 1, "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" } } } }, "watch": { "input": { "simple": { "payload": { "send": "yes" } } }, "condition": { "always": {} }, "trigger": { "schedule": { "hourly": { "minute": [0, 5] } } }, "actions": { "test_index": { "index": { "index": "test" } } } } }