原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/watcher-api-activate-watch.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/watcher-api-activate-watch.html
本地英文版地址: ../en/watcher-api-activate-watch.html
重要: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 当前版本文档。
Activate watch APIedit
A watch can be either active or inactive. This API enables you to activate a currently inactive watch.
Requestedit
PUT _watcher/watch/<watch_id>/_activate
Prerequisitesedit
-
You must have
manage_watcher
cluster privileges to use this API. For more information, see Security privileges.
Path parametersedit
-
<watch_id>
- (Required, string) Identifier for the watch.
Examplesedit
The status of an inactive watch is returned with the watch definition when you call the get watch API:
GET _watcher/watch/my_watch
{ "found": true, "_id": "my_watch", "_seq_no": 0, "_primary_term": 1, "_version": 1, "status": { "state" : { "active" : false, "timestamp" : "2015-08-20T12:21:32.734Z" }, "actions": ..., "version": 1 }, "watch": ... }
You can activate the watch by executing the following API call:
PUT _watcher/watch/my_watch/_activate
The new state of the watch is returned as part of its overall status:
{ "status": { "state" : { "active" : true, "timestamp" : "2015-09-04T08:39:46.816Z" }, "actions": ..., "version": 1 } }