Run a watch
This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.
For testing and debugging purposes, you also have fine-grained control on how the watch runs. You can run the watch without running all of its actions or alternatively by simulating them. You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.
You can use the run watch API to run watches that are not yet registered by specifying the watch definition inline. This serves as great tool for testing and debugging your watches prior to adding them to Watcher.
Query parameters
-
debug boolean
Defines whether the watch runs in debug mode.
Body
-
action_modes object
Determines how to handle the watch actions as part of the watch execution.
-
alternative_input object
When present, the watch uses this object as a payload instead of executing its own input.
-
ignore_condition boolean
When set to
true
, the watch execution uses the always condition. This can also be specified as an HTTP parameter. -
record_execution boolean
When set to
true
, the watch record representing the watch execution result is persisted to the.watcher-history
index for the current time. In addition, the status of the watch is updated, possibly throttling subsequent executions. This can also be specified as an HTTP parameter. -
simulated_actions object
Additional properties are allowed.
-
trigger_data object
Additional properties are allowed.
-
watch object
Additional properties are allowed.
curl \
-X PUT http://api.example.com/_watcher/watch/_execute \
-H "Content-Type: application/json" \
-d '{"action_modes":{"additionalProperty1":"simulate","additionalProperty2":"simulate"},"alternative_input":{"additionalProperty1":{},"additionalProperty2":{}},"ignore_condition":true,"record_execution":true,"simulated_actions":{"actions":["string"],"all":{},"use_all":true},"trigger_data":{"":"string"},"watch":{"actions":{"additionalProperty1":{"action_type":"email","condition":{"always":{},"array_compare":{"additionalProperty1":{"path":"string"},"additionalProperty2":{"path":"string"}},"compare":{"additionalProperty1":{},"additionalProperty2":{}},"never":{},"script":{"lang":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"source":"string","id":"string"}},"foreach":"string","max_iterations":42.0,"name":"string","throttle_period":"string","":{"auth":{"basic":{}},"body":"string","connection_timeout":"string","headers":{"additionalProperty1":"string","additionalProperty2":"string"},"host":"string","method":"head","params":{"additionalProperty1":"string","additionalProperty2":"string"},"path":"string","port":42.0,"proxy":{"host":"string","port":42.0},"read_timeout":"string","scheme":"http","url":"string"},"transform":{"chain":[{}],"script":{"lang":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"source":"string","id":"string"},"search":{"request":{"body":{},"indices":["string"],"indices_options":{},"search_type":"query_then_fetch","template":{},"rest_total_hits_as_int":true},"timeout":"string"}},"index":{"index":"string","doc_id":"string","refresh":"true","op_type":"index","timeout":"string","execution_time_field":"string"},"logging":{"level":"string","text":"string","category":"string"},"slack":{"account":"string","message":{"attachments":[{}],"dynamic_attachments":{"attachment_template":{},"list_path":"string"},"from":"string","icon":"string","text":"string","to":["string"]}}},"additionalProperty2":{"action_type":"email","condition":{"always":{},"array_compare":{"additionalProperty1":{"path":"string"},"additionalProperty2":{"path":"string"}},"compare":{"additionalProperty1":{},"additionalProperty2":{}},"never":{},"script":{"lang":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"source":"string","id":"string"}},"foreach":"string","max_iterations":42.0,"name":"string","throttle_period":"string","":{"auth":{"basic":{}},"body":"string","connection_timeout":"string","headers":{"additionalProperty1":"string","additionalProperty2":"string"},"host":"string","method":"head","params":{"additionalProperty1":"string","additionalProperty2":"string"},"path":"string","port":42.0,"proxy":{"host":"string","port":42.0},"read_timeout":"string","scheme":"http","url":"string"},"transform":{"chain":[{}],"script":{"lang":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"source":"string","id":"string"},"search":{"request":{"body":{},"indices":["string"],"indices_options":{},"search_type":"query_then_fetch","template":{},"rest_total_hits_as_int":true},"timeout":"string"}},"index":{"index":"string","doc_id":"string","refresh":"true","op_type":"index","timeout":"string","execution_time_field":"string"},"logging":{"level":"string","text":"string","category":"string"},"slack":{"account":"string","message":{"attachments":[{}],"dynamic_attachments":{"attachment_template":{},"list_path":"string"},"from":"string","icon":"string","text":"string","to":["string"]}}}},"condition":{"always":{},"array_compare":{"additionalProperty1":{"path":"string"},"additionalProperty2":{"path":"string"}},"compare":{"additionalProperty1":{},"additionalProperty2":{}},"never":{},"script":{"lang":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"source":"string","id":"string"}},"input":{"chain":{"inputs":[{"*":{}}]},"http":{"extract":["string"],"request":{"auth":{"basic":{"password":"string","username":"string"}},"body":"string","connection_timeout":"string","headers":{"additionalProperty1":"string","additionalProperty2":"string"},"host":"string","method":"head","params":{"additionalProperty1":"string","additionalProperty2":"string"},"path":"string","port":42.0,"proxy":{"host":"string","port":42.0},"read_timeout":"string","scheme":"http","url":"string"},"response_content_type":"json"},"search":{"extract":["string"],"request":{"body":{"query":{}},"indices":["string"],"indices_options":{"allow_no_indices":true,"expand_wildcards":"string","ignore_unavailable":true,"ignore_throttled":true},"search_type":"query_then_fetch","template":{"explain":true,"id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"profile":true,"source":"string"},"rest_total_hits_as_int":true},"timeout":"string"},"simple":{"additionalProperty1":{},"additionalProperty2":{}}},"metadata":{"additionalProperty1":{},"additionalProperty2":{}},"status":{"actions":{"additionalProperty1":{"ack":{"state":"awaits_successful_execution","":"string"},"last_execution":{"successful":true,"":"string","reason":"string"},"last_successful_execution":{"successful":true,"":"string","reason":"string"},"last_throttle":{"reason":"string","":"string"}},"additionalProperty2":{"ack":{"state":"awaits_successful_execution","":"string"},"last_execution":{"successful":true,"":"string","reason":"string"},"last_successful_execution":{"successful":true,"":"string","reason":"string"},"last_throttle":{"reason":"string","":"string"}}},"":"string","state":{"active":true,"":"string"},"version":42.0,"execution_state":"string"},"throttle_period":"string","":42.0,"transform":{"chain":[{}],"script":{"lang":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"source":"string","id":"string"},"search":{"request":{"body":{"query":{}},"indices":["string"],"indices_options":{"allow_no_indices":true,"expand_wildcards":"string","ignore_unavailable":true,"ignore_throttled":true},"search_type":"query_then_fetch","template":{"explain":true,"id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"profile":true,"source":"string"},"rest_total_hits_as_int":true},"timeout":"string"}},"trigger":{"schedule":{"cron":"string","daily":{"at":["string"]},"hourly":{"minute":[42.0]},"interval":"string","monthly":{"at":["string"],"on":[42.0]},"weekly":{"at":["string"],"on":["sunday"]},"yearly":{"at":["string"],"int":["january"],"on":[42.0]}}}}}'
{
"action_modes": {
"additionalProperty1": "simulate",
"additionalProperty2": "simulate"
},
"alternative_input": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"ignore_condition": true,
"record_execution": true,
"simulated_actions": {
"actions": [
"string"
],
"all": {},
"use_all": true
},
"trigger_data": {
"": "string"
},
"watch": {
"actions": {
"additionalProperty1": {
"action_type": "email",
"condition": {
"always": {},
"array_compare": {
"additionalProperty1": {
"path": "string"
},
"additionalProperty2": {
"path": "string"
}
},
"compare": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"never": {},
"script": {
"lang": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"source": "string",
"id": "string"
}
},
"foreach": "string",
"max_iterations": 42.0,
"name": "string",
"throttle_period": "string",
"": {
"auth": {
"basic": {}
},
"body": "string",
"connection_timeout": "string",
"headers": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"host": "string",
"method": "head",
"params": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"path": "string",
"port": 42.0,
"proxy": {
"host": "string",
"port": 42.0
},
"read_timeout": "string",
"scheme": "http",
"url": "string"
},
"transform": {
"chain": [
{}
],
"script": {
"lang": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"source": "string",
"id": "string"
},
"search": {
"request": {
"body": {},
"indices": [
"string"
],
"indices_options": {},
"search_type": "query_then_fetch",
"template": {},
"rest_total_hits_as_int": true
},
"timeout": "string"
}
},
"index": {
"index": "string",
"doc_id": "string",
"refresh": "true",
"op_type": "index",
"timeout": "string",
"execution_time_field": "string"
},
"logging": {
"level": "string",
"text": "string",
"category": "string"
},
"slack": {
"account": "string",
"message": {
"attachments": [
{}
],
"dynamic_attachments": {
"attachment_template": {},
"list_path": "string"
},
"from": "string",
"icon": "string",
"text": "string",
"to": [
"string"
]
}
}
},
"additionalProperty2": {
"action_type": "email",
"condition": {
"always": {},
"array_compare": {
"additionalProperty1": {
"path": "string"
},
"additionalProperty2": {
"path": "string"
}
},
"compare": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"never": {},
"script": {
"lang": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"source": "string",
"id": "string"
}
},
"foreach": "string",
"max_iterations": 42.0,
"name": "string",
"throttle_period": "string",
"": {
"auth": {
"basic": {}
},
"body": "string",
"connection_timeout": "string",
"headers": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"host": "string",
"method": "head",
"params": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"path": "string",
"port": 42.0,
"proxy": {
"host": "string",
"port": 42.0
},
"read_timeout": "string",
"scheme": "http",
"url": "string"
},
"transform": {
"chain": [
{}
],
"script": {
"lang": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"source": "string",
"id": "string"
},
"search": {
"request": {
"body": {},
"indices": [
"string"
],
"indices_options": {},
"search_type": "query_then_fetch",
"template": {},
"rest_total_hits_as_int": true
},
"timeout": "string"
}
},
"index": {
"index": "string",
"doc_id": "string",
"refresh": "true",
"op_type": "index",
"timeout": "string",
"execution_time_field": "string"
},
"logging": {
"level": "string",
"text": "string",
"category": "string"
},
"slack": {
"account": "string",
"message": {
"attachments": [
{}
],
"dynamic_attachments": {
"attachment_template": {},
"list_path": "string"
},
"from": "string",
"icon": "string",
"text": "string",
"to": [
"string"
]
}
}
}
},
"condition": {
"always": {},
"array_compare": {
"additionalProperty1": {
"path": "string"
},
"additionalProperty2": {
"path": "string"
}
},
"compare": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"never": {},
"script": {
"lang": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"source": "string",
"id": "string"
}
},
"input": {
"chain": {
"inputs": [
{
"*": {}
}
]
},
"http": {
"extract": [
"string"
],
"request": {
"auth": {
"basic": {
"password": "string",
"username": "string"
}
},
"body": "string",
"connection_timeout": "string",
"headers": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"host": "string",
"method": "head",
"params": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"path": "string",
"port": 42.0,
"proxy": {
"host": "string",
"port": 42.0
},
"read_timeout": "string",
"scheme": "http",
"url": "string"
},
"response_content_type": "json"
},
"search": {
"extract": [
"string"
],
"request": {
"body": {
"query": {}
},
"indices": [
"string"
],
"indices_options": {
"allow_no_indices": true,
"expand_wildcards": "string",
"ignore_unavailable": true,
"ignore_throttled": true
},
"search_type": "query_then_fetch",
"template": {
"explain": true,
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"profile": true,
"source": "string"
},
"rest_total_hits_as_int": true
},
"timeout": "string"
},
"simple": {
"additionalProperty1": {},
"additionalProperty2": {}
}
},
"metadata": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"status": {
"actions": {
"additionalProperty1": {
"ack": {
"state": "awaits_successful_execution",
"": "string"
},
"last_execution": {
"successful": true,
"": "string",
"reason": "string"
},
"last_successful_execution": {
"successful": true,
"": "string",
"reason": "string"
},
"last_throttle": {
"reason": "string",
"": "string"
}
},
"additionalProperty2": {
"ack": {
"state": "awaits_successful_execution",
"": "string"
},
"last_execution": {
"successful": true,
"": "string",
"reason": "string"
},
"last_successful_execution": {
"successful": true,
"": "string",
"reason": "string"
},
"last_throttle": {
"reason": "string",
"": "string"
}
}
},
"": "string",
"state": {
"active": true,
"": "string"
},
"version": 42.0,
"execution_state": "string"
},
"throttle_period": "string",
"": 42.0,
"transform": {
"chain": [
{}
],
"script": {
"lang": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"source": "string",
"id": "string"
},
"search": {
"request": {
"body": {
"query": {}
},
"indices": [
"string"
],
"indices_options": {
"allow_no_indices": true,
"expand_wildcards": "string",
"ignore_unavailable": true,
"ignore_throttled": true
},
"search_type": "query_then_fetch",
"template": {
"explain": true,
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"profile": true,
"source": "string"
},
"rest_total_hits_as_int": true
},
"timeout": "string"
}
},
"trigger": {
"schedule": {
"cron": "string",
"daily": {
"at": [
"string"
]
},
"hourly": {
"minute": [
42.0
]
},
"interval": "string",
"monthly": {
"at": [
"string"
],
"on": [
42.0
]
},
"weekly": {
"at": [
"string"
],
"on": [
"sunday"
]
},
"yearly": {
"at": [
"string"
],
"int": [
"january"
],
"on": [
42.0
]
}
}
}
}
}
{
"_id": "string",
"watch_record": {
"condition": {
"always": {},
"array_compare": {
"additionalProperty1": {
"path": "string"
},
"additionalProperty2": {
"path": "string"
}
},
"compare": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"never": {},
"script": {
"lang": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"source": "string",
"id": "string"
}
},
"input": {
"chain": {
"inputs": [
{
"*": {}
}
]
},
"http": {
"extract": [
"string"
],
"request": {
"auth": {
"basic": {}
},
"body": "string",
"connection_timeout": "string",
"headers": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"host": "string",
"method": "head",
"params": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"path": "string",
"port": 42.0,
"proxy": {
"host": "string",
"port": 42.0
},
"read_timeout": "string",
"scheme": "http",
"url": "string"
},
"response_content_type": "json"
},
"search": {
"extract": [
"string"
],
"request": {
"body": {
"query": {}
},
"indices": [
"string"
],
"indices_options": {
"allow_no_indices": true,
"expand_wildcards": "string",
"ignore_unavailable": true,
"ignore_throttled": true
},
"search_type": "query_then_fetch",
"template": {
"explain": true,
"id": "string",
"params": {},
"profile": true,
"source": "string"
},
"rest_total_hits_as_int": true
},
"timeout": "string"
},
"simple": {
"additionalProperty1": {},
"additionalProperty2": {}
}
},
"messages": [
"string"
],
"metadata": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"node": "string",
"result": {
"actions": [
{
"email": {
"account": "string",
"message": {},
"reason": "string"
},
"id": "string",
"index": {
"response": {}
},
"logging": {
"logged_text": "string"
},
"pagerduty": {
"event": {},
"reason": "string",
"response": {}
},
"reason": "string",
"slack": {
"account": "string",
"message": {}
},
"status": "success",
"type": "email",
"webhook": {
"response": {}
},
"error": {
"type": "string",
"reason": "string",
"stack_trace": "string",
"caused_by": {},
"root_cause": [
{}
],
"suppressed": [
{}
]
}
}
],
"condition": {
"met": true,
"status": "success",
"type": "always"
},
"": "string",
"input": {
"payload": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"status": "success",
"type": "http"
}
},
"state": "awaits_execution",
"trigger_event": {
"manual": {
"schedule": {
"": "string"
}
},
"": "string",
"type": "string"
},
"user": "string",
"watch_id": "string",
"status": {
"actions": {
"additionalProperty1": {
"ack": {
"state": "awaits_successful_execution"
},
"last_execution": {
"successful": true,
"reason": "string"
},
"last_successful_execution": {
"successful": true,
"reason": "string"
},
"last_throttle": {
"reason": "string"
}
},
"additionalProperty2": {
"ack": {
"state": "awaits_successful_execution"
},
"last_execution": {
"successful": true,
"reason": "string"
},
"last_successful_execution": {
"successful": true,
"reason": "string"
},
"last_throttle": {
"reason": "string"
}
}
},
"": "string",
"state": {
"active": true,
"": "string"
},
"version": 42.0,
"execution_state": "string"
}
}
}