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.
When Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.
If your user is allowed to read index a
, but not index b
, then the exact same set of rules will apply during execution of a watch.
When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.
Path parameters
-
id
string Required The watch identifier.
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.
Hide action_modes attribute Show action_modes attribute object
-
*
string Additional properties Values are
simulate
,force_simulate
,execute
,force_execute
, orskip
.
-
-
alternative_input
object When present, the watch uses this object as a payload instead of executing its own input.
Hide alternative_input attribute Show alternative_input attribute object
-
*
object Additional properties
-
-
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 runs. This can also be specified as an HTTP parameter. -
simulated_actions
object -
trigger_data
object Hide trigger_data attributes Show trigger_data attributes object
scheduled_time
string | number Required 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
triggered_time
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
-
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
, orpagerduty
. -
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) andd
(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
-
search
object Hide search attributes Show search attributes object
-
request
object Required Hide request attributes Show request attributes object
-
body
object -
indices
array[string] -
indices_options
object -
search_type
string Values are
query_then_fetch
ordfs_query_then_fetch
. -
template
object -
rest_total_hits_as_int
boolean
-
-
timeout
string Required A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
-
index
object Hide index attributes Show index attributes object
-
index
string Required -
doc_id
string -
refresh
string Values are
true
,false
, orwait_for
. -
op_type
string Values are
index
orcreate
. -
timeout
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
execution_time_field
string Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.
-
-
logging
object -
email
object Hide email attributes Show email attributes object
-
id
string bcc
string | array[string] -
body
object cc
string | array[string] -
from
string -
priority
string Values are
lowest
,low
,normal
,high
, orhighest
. reply_to
string | array[string] -
sent_date
string -
subject
string Required to
string | array[string] Required -
attachments
object Hide attachments attribute Show attachments attribute object
-
*
object Additional properties
-
-
-
pagerduty
object Hide pagerduty attributes Show pagerduty attributes object
-
account
string -
attach_payload
boolean Required -
client
string -
client_url
string -
contexts
array[object] -
description
string Required -
event_type
string Values are
trigger
,resolve
, oracknowledge
. -
incident_key
string Required -
proxy
object
-
-
slack
object Hide slack attributes Show slack attributes object
-
account
string -
message
object Required Hide message attributes Show message attributes object
-
attachments
array[object] Required -
dynamic_attachments
object Hide dynamic_attachments attributes Show dynamic_attachments attributes object
-
attachment_template
object Required -
list_path
string Required
-
-
from
string Required -
icon
string -
text
string Required -
to
array[string] Required
-
-
-
webhook
object Hide webhook attributes Show webhook attributes object
-
auth
object Hide auth attribute Show auth attribute object
-
basic
object Required
-
-
body
string -
connection_timeout
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
headers
object Hide headers attribute Show headers attribute object
-
*
string Additional properties
-
-
host
string -
method
string Values are
head
,get
,post
,put
, ordelete
. -
params
object Hide params attribute Show params attribute object
-
*
string Additional properties
-
-
path
string -
port
number -
proxy
object -
read_timeout
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
scheme
string Values are
http
orhttps
. -
url
string
-
-
-
-
condition
object Required Hide condition attributes Show condition attributes object
-
always
object -
array_compare
object -
compare
object Hide compare attribute Show compare attribute object
-
*
object Additional properties
-
-
never
object -
script
object Hide script attributes Show script attributes object
-
params
object Hide params attribute Show params attribute object
-
*
object Additional properties
-
source
string | object One of: Hide attributes Show attributes
-
aggregations
object Defines the aggregations that are run as part of the search request.
External documentation -
collapse
object External documentation -
explain
boolean If
true
, the request returns detailed information about score computation as part of a hit. -
ext
object Configuration of search extensions defined by Elasticsearch plugins.
Hide ext attribute Show ext attribute object
-
*
object Additional properties
-
-
from
number The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the
from
andsize
parameters. To page through more hits, use thesearch_after
parameter. -
highlight
object -
track_total_hits
boolean | number Number of hits matching the query to count accurately. If true, the exact number of hits is returned at the cost of some performance. If false, the response does not include the total number of hits matching the query. Defaults to 10,000 hits.
-
indices_boost
array[object] Boost the
_score
of documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than1.0
increases the score. A boost value between0
and1.0
decreases the score.External documentation -
docvalue_fields
array[object] An array of wildcard (
*
) field patterns. The request returns doc values for field names matching these patterns in thehits.fields
property of the response.External documentation knn
object | array[object] The approximate kNN search to run.
-
rank
object Hide rank attribute Show rank attribute object
-
min_score
number The minimum
_score
for matching documents. Documents with a lower_score
are not included in search results or results collected by aggregations. -
post_filter
object An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation -
profile
boolean Set to
true
to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. -
query
object An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation -
rescore
array[object] -
retriever
object Hide retriever attributes Show retriever attributes object
-
script_fields
object Retrieve a script evaluation (based on different fields) for each hit.
Hide script_fields attribute Show script_fields attribute object
-
*
object Additional properties
-
-
search_after
array[number | string | boolean | null] A field value.
-
size
number The number of hits to return, which must not be negative. By default, you cannot page through more than 10,000 hits using the
from
andsize
parameters. To page through more hits, use thesearch_after
property. -
slice
object -
sort
array[string | object] _source
boolean | object Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.
-
fields
array[object] An array of wildcard (
*
) field patterns. The request returns values for field names matching these patterns in thehits.fields
property of the response. -
suggest
object Hide suggest attribute Show suggest attribute object
-
text
string Global suggest text, to avoid repetition when the same text is used in several suggesters
-
-
terminate_after
number The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting.
IMPORTANT: Use with caution. Elasticsearch applies this property to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers.
If set to
0
(default), the query does not terminate early. -
timeout
string The period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout.
-
track_scores
boolean If
true
, calculate and return document scores, even if the scores are not used for sorting. -
version
boolean If
true
, the request returns the document version as part of a hit. -
seq_no_primary_term
boolean If
true
, the request returns sequence number and primary term of the last modification of each hit.External documentation -
stored_fields
string | array[string] -
pit
object Hide pit attributes Show pit attributes object
-
id
string Required -
keep_alive
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
runtime_mappings
object Hide runtime_mappings attribute Show runtime_mappings attribute object
-
*
object Additional properties
-
-
stats
array[string] The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API.
-
-
id
string
-
-
input
object Required Hide input attributes Show input attributes object
-
chain
object -
http
object Hide http attributes Show http attributes object
-
extract
array[string] -
request
object Hide request attributes Show request attributes object
-
auth
object -
body
string -
connection_timeout
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
headers
object Hide headers attribute Show headers attribute object
-
*
string Additional properties
-
-
host
string -
method
string Values are
head
,get
,post
,put
, ordelete
. -
params
object Hide params attribute Show params attribute object
-
*
string Additional properties
-
-
path
string -
port
number -
proxy
object -
read_timeout
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
scheme
string Values are
http
orhttps
. -
url
string
-
-
response_content_type
string Values are
json
,yaml
, ortext
.
-
-
search
object Hide search attributes Show search attributes object
-
extract
array[string] -
request
object Required Hide request attributes Show request attributes object
-
body
object Hide body attribute Show body attribute object
-
query
object Required An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation
-
-
indices
array[string] -
indices_options
object Hide indices_options attributes Show indices_options attributes object
-
allow_no_indices
boolean If false, the request returns an error if any wildcard expression, index alias, or
_all
value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targetingfoo*,bar*
returns an error if an index starts withfoo
but no index starts withbar
. -
expand_wildcards
string | array[string] -
ignore_unavailable
boolean If true, missing or closed indices are not included in the response.
-
ignore_throttled
boolean If true, concrete, expanded or aliased indices are ignored when frozen.
-
-
search_type
string Values are
query_then_fetch
ordfs_query_then_fetch
. -
template
object Hide template attributes Show template attributes object
-
explain
boolean -
id
string -
params
object Hide params attribute Show params attribute object
-
*
object Additional properties
-
-
profile
boolean -
source
string An inline search template. Supports the same parameters as the search API's request body. Also supports Mustache variables. If no id is specified, this parameter is required.
-
-
rest_total_hits_as_int
boolean
-
-
timeout
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
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 Hide * attributes Show * attributes object
-
ack
object Required -
last_execution
object Hide last_execution attributes Show last_execution attributes object
-
successful
boolean Required -
timestamp
string -
reason
string
-
-
last_successful_execution
object Hide last_successful_execution attributes Show last_successful_execution attributes object
-
successful
boolean Required -
timestamp
string -
reason
string
-
-
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 | number Required 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
-
-
version
number Required -
execution_state
string
-
-
throttle_period
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(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 -
params
object Hide params attribute Show params attribute object
-
*
object Additional properties
-
source
string | object One of: Hide attributes Show attributes
-
aggregations
object Defines the aggregations that are run as part of the search request.
External documentation -
collapse
object External documentation -
explain
boolean If
true
, the request returns detailed information about score computation as part of a hit. -
ext
object Configuration of search extensions defined by Elasticsearch plugins.
Hide ext attribute Show ext attribute object
-
*
object Additional properties
-
-
from
number The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the
from
andsize
parameters. To page through more hits, use thesearch_after
parameter. -
highlight
object -
track_total_hits
boolean | number Number of hits matching the query to count accurately. If true, the exact number of hits is returned at the cost of some performance. If false, the response does not include the total number of hits matching the query. Defaults to 10,000 hits.
-
indices_boost
array[object] Boost the
_score
of documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than1.0
increases the score. A boost value between0
and1.0
decreases the score.External documentation -
docvalue_fields
array[object] An array of wildcard (
*
) field patterns. The request returns doc values for field names matching these patterns in thehits.fields
property of the response.External documentation knn
object | array[object] The approximate kNN search to run.
-
rank
object Hide rank attribute Show rank attribute object
-
min_score
number The minimum
_score
for matching documents. Documents with a lower_score
are not included in search results or results collected by aggregations. -
post_filter
object An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation -
profile
boolean Set to
true
to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. -
query
object An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation -
rescore
array[object] -
retriever
object Hide retriever attributes Show retriever attributes object
-
script_fields
object Retrieve a script evaluation (based on different fields) for each hit.
Hide script_fields attribute Show script_fields attribute object
-
*
object Additional properties
-
-
search_after
array[number | string | boolean | null] A field value.
-
size
number The number of hits to return, which must not be negative. By default, you cannot page through more than 10,000 hits using the
from
andsize
parameters. To page through more hits, use thesearch_after
property. -
slice
object -
sort
array[string | object] _source
boolean | object Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.
-
fields
array[object] An array of wildcard (
*
) field patterns. The request returns values for field names matching these patterns in thehits.fields
property of the response. -
suggest
object Hide suggest attribute Show suggest attribute object
-
text
string Global suggest text, to avoid repetition when the same text is used in several suggesters
-
-
terminate_after
number The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting.
IMPORTANT: Use with caution. Elasticsearch applies this property to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers.
If set to
0
(default), the query does not terminate early. -
timeout
string The period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout.
-
track_scores
boolean If
true
, calculate and return document scores, even if the scores are not used for sorting. -
version
boolean If
true
, the request returns the document version as part of a hit. -
seq_no_primary_term
boolean If
true
, the request returns sequence number and primary term of the last modification of each hit.External documentation -
stored_fields
string | array[string] -
pit
object Hide pit attributes Show pit attributes object
-
id
string Required -
keep_alive
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
runtime_mappings
object Hide runtime_mappings attribute Show runtime_mappings attribute object
-
*
object Additional properties
-
-
stats
array[string] The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API.
-
-
id
string
-
-
search
object Hide search attributes Show search attributes object
-
request
object Required Hide request attributes Show request attributes object
-
body
object Hide body attribute Show body attribute object
-
query
object Required An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation
-
-
indices
array[string] -
indices_options
object Hide indices_options attributes Show indices_options attributes object
-
allow_no_indices
boolean If false, the request returns an error if any wildcard expression, index alias, or
_all
value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targetingfoo*,bar*
returns an error if an index starts withfoo
but no index starts withbar
. -
expand_wildcards
string | array[string] -
ignore_unavailable
boolean If true, missing or closed indices are not included in the response.
-
ignore_throttled
boolean If true, concrete, expanded or aliased indices are ignored when frozen.
-
-
search_type
string Values are
query_then_fetch
ordfs_query_then_fetch
. -
template
object Hide template attributes Show template attributes object
-
explain
boolean -
id
string -
params
object Hide params attribute Show params attribute object
-
*
object Additional properties
-
-
profile
boolean -
source
string An inline search template. Supports the same parameters as the search API's request body. Also supports Mustache variables. If no id is specified, this parameter is required.
-
-
rest_total_hits_as_int
boolean
-
-
timeout
string Required A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
-
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 Hide daily attribute Show daily attribute object
-
at
array[string | object] Required A time of day, expressed either as
hh:mm
,noon
,midnight
, or an hour/minutes structure.A time of day, expressed either as
hh:mm
,noon
,midnight
, or an hour/minutes structure.
-
-
hourly
object Hide hourly attribute Show hourly attribute object
-
minute
array[number] Required
-
-
interval
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
-
Responses
-
200 application/json
Hide response attributes Show response attributes object
-
_id
string Required -
watch_record
object Required Hide watch_record attributes Show watch_record attributes object
-
condition
object Required Hide condition attributes Show condition attributes object
-
always
object -
array_compare
object -
compare
object Hide compare attribute Show compare attribute object
-
*
object Additional properties
-
-
never
object -
script
object Hide script attributes Show script attributes object
-
params
object Hide params attribute Show params attribute object
-
*
object Additional properties
-
source
string | object One of: Hide attributes Show attributes
-
aggregations
object Defines the aggregations that are run as part of the search request.
-
collapse
object -
explain
boolean If
true
, the request returns detailed information about score computation as part of a hit. -
ext
object Configuration of search extensions defined by Elasticsearch plugins.
-
from
number The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the
from
andsize
parameters. To page through more hits, use thesearch_after
parameter. -
track_total_hits
boolean | number Number of hits matching the query to count accurately. If true, the exact number of hits is returned at the cost of some performance. If false, the response does not include the total number of hits matching the query. Defaults to 10,000 hits.
-
indices_boost
array[object] Boost the
_score
of documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than1.0
increases the score. A boost value between0
and1.0
decreases the score. -
docvalue_fields
array[object] An array of wildcard (
*
) field patterns. The request returns doc values for field names matching these patterns in thehits.fields
property of the response. -
rank
object -
min_score
number The minimum
_score
for matching documents. Documents with a lower_score
are not included in search results or results collected by aggregations. -
post_filter
object An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
-
profile
boolean Set to
true
to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. -
query
object An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
-
retriever
object -
script_fields
object Retrieve a script evaluation (based on different fields) for each hit.
-
search_after
array[number | string | boolean | null] A field value.
-
size
number The number of hits to return, which must not be negative. By default, you cannot page through more than 10,000 hits using the
from
andsize
parameters. To page through more hits, use thesearch_after
property. -
slice
object -
fields
array[object] An array of wildcard (
*
) field patterns. The request returns values for field names matching these patterns in thehits.fields
property of the response. -
suggest
object -
terminate_after
number The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting.
IMPORTANT: Use with caution. Elasticsearch applies this property to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers.
If set to
0
(default), the query does not terminate early. -
timeout
string The period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout.
-
track_scores
boolean If
true
, calculate and return document scores, even if the scores are not used for sorting. -
version
boolean If
true
, the request returns the document version as part of a hit. -
seq_no_primary_term
boolean If
true
, the request returns sequence number and primary term of the last modification of each hit. -
stored_fields
string | array[string] -
pit
object -
runtime_mappings
object -
stats
array[string] The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API.
-
-
id
string
-
-
input
object Required Hide input attributes Show input attributes object
-
chain
object -
http
object Hide http attributes Show http attributes object
-
extract
array[string] -
request
object Hide request attributes Show request attributes object
-
auth
object Hide auth attribute Show auth attribute object
-
basic
object Required
-
-
body
string -
connection_timeout
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
headers
object Hide headers attribute Show headers attribute object
-
*
string Additional properties
-
-
host
string -
method
string Values are
head
,get
,post
,put
, ordelete
. -
params
object Hide params attribute Show params attribute object
-
*
string Additional properties
-
-
path
string -
port
number -
proxy
object -
read_timeout
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
scheme
string Values are
http
orhttps
. -
url
string
-
-
response_content_type
string Values are
json
,yaml
, ortext
.
-
-
search
object Hide search attributes Show search attributes object
-
extract
array[string] -
request
object Required Hide request attributes Show request attributes object
-
body
object Hide body attribute Show body attribute object
-
query
object Required An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
-
-
indices
array[string] -
indices_options
object Hide indices_options attributes Show indices_options attributes object
-
allow_no_indices
boolean If false, the request returns an error if any wildcard expression, index alias, or
_all
value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targetingfoo*,bar*
returns an error if an index starts withfoo
but no index starts withbar
. -
expand_wildcards
string | array[string] -
ignore_unavailable
boolean If true, missing or closed indices are not included in the response.
-
ignore_throttled
boolean If true, concrete, expanded or aliased indices are ignored when frozen.
-
-
search_type
string Values are
query_then_fetch
ordfs_query_then_fetch
. -
template
object Hide template attributes Show template attributes object
-
rest_total_hits_as_int
boolean
-
-
timeout
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
simple
object Hide simple attribute Show simple attribute object
-
*
object Additional properties
-
-
-
messages
array[string] Required -
metadata
object Hide metadata attribute Show metadata attribute object
-
*
object Additional properties
-
-
node
string Required -
result
object Required Hide result attributes Show result attributes object
-
actions
array[object] Required Hide actions attributes Show actions attributes object
-
email
object -
id
string Required -
index
object Hide index attribute Show index attribute object
-
response
object Required
-
-
logging
object Hide logging attribute Show logging attribute object
-
logged_text
string Required
-
-
pagerduty
object -
reason
string -
slack
object -
status
string Required Values are
success
,failure
,simulated
, orthrottled
. -
type
string Required Values are
email
,webhook
,index
,logging
,slack
, orpagerduty
. -
webhook
object -
error
object Hide error attributes Show error attributes object
-
type
string Required The type of error
-
reason
string A human-readable explanation of the error, in English.
-
stack_trace
string The server stack trace. Present only if the
error_trace=true
parameter was sent with the request. -
caused_by
object -
root_cause
array[object] -
suppressed
array[object]
-
-
-
condition
object Required -
execution_duration
number Time unit for milliseconds
execution_time
string | number Required 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
-
input
object Required
-
-
state
string Required Values are
awaits_execution
,checking
,execution_not_needed
,throttled
,executed
,failed
,deleted_while_queued
, ornot_executed_already_queued
. -
trigger_event
object Required Hide trigger_event attributes Show trigger_event attributes object
-
manual
object Required Hide manual attribute Show manual attribute object
-
schedule
object Hide schedule attributes Show schedule attributes object
-
scheduled_time
string -
triggered_time
string
-
-
triggered_time
string | number Required 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
-
type
string Required
-
-
user
string Required -
watch_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 Hide last_execution attributes Show last_execution attributes object
-
successful
boolean Required -
reason
string
-
-
last_successful_execution
object Hide last_successful_execution attributes Show last_successful_execution attributes object
-
successful
boolean Required -
reason
string
-
-
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 | number Required 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
-
-
version
number Required -
execution_state
string
-
-
-
curl \
--request PUT 'http://api.example.com/_watcher/watch/{id}/_execute' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"trigger_data\" : { \n \"triggered_time\" : \"now\",\n \"scheduled_time\" : \"now\"\n },\n \"alternative_input\" : { \n \"foo\" : \"bar\"\n },\n \"ignore_condition\" : true, \n \"action_modes\" : {\n \"my-action\" : \"force_simulate\" \n },\n \"record_execution\" : true \n}"'
{
"trigger_data" : {
"triggered_time" : "now",
"scheduled_time" : "now"
},
"alternative_input" : {
"foo" : "bar"
},
"ignore_condition" : true,
"action_modes" : {
"my-action" : "force_simulate"
},
"record_execution" : true
}
{
"action_modes" : {
"action1" : "force_simulate",
"action2" : "skip"
}
}
{
"watch" : {
"trigger" : { "schedule" : { "interval" : "10s" } },
"input" : {
"search" : {
"request" : {
"indices" : [ "logs" ],
"body" : {
"query" : {
"match" : { "message": "error" }
}
}
}
}
},
"condition" : {
"compare" : { "ctx.payload.hits.total" : { "gt" : 0 }}
},
"actions" : {
"log_error" : {
"logging" : {
"text" : "Found {{ctx.payload.hits.total}} errors in the logs"
}
}
}
}
}
{
"_id": "my_watch_0-2015-06-02T23:17:55.124Z",
"watch_record": {
"@timestamp": "2015-06-02T23:17:55.124Z",
"watch_id": "my_watch",
"node": "my_node",
"messages": [],
"trigger_event": {
"type": "manual",
"triggered_time": "2015-06-02T23:17:55.124Z",
"manual": {
"schedule": {
"scheduled_time": "2015-06-02T23:17:55.124Z"
}
}
},
"state": "executed",
"status": {
"version": 1,
"execution_state": "executed",
"state": {
"active": true,
"timestamp": "2015-06-02T23:17:55.111Z"
},
"last_checked": "2015-06-02T23:17:55.124Z",
"last_met_condition": "2015-06-02T23:17:55.124Z",
"actions": {
"test_index": {
"ack": {
"timestamp": "2015-06-02T23:17:55.124Z",
"state": "ackable"
},
"last_execution": {
"timestamp": "2015-06-02T23:17:55.124Z",
"successful": true
},
"last_successful_execution": {
"timestamp": "2015-06-02T23:17:55.124Z",
"successful": true
}
}
}
},
"input": {
"simple": {
"payload": {
"send": "yes"
}
}
},
"condition": {
"always": {}
},
"result": {
"execution_time": "2015-06-02T23:17:55.124Z",
"execution_duration": 12608,
"input": {
"type": "simple",
"payload": {
"foo": "bar"
},
"status": "success"
},
"condition": {
"type": "always",
"met": true,
"status": "success"
},
"actions": [
{
"id": "test_index",
"index": {
"response": {
"index": "test",
"version": 1,
"created": true,
"result": "created",
"id": "AVSHKzPa9zx62AzUzFXY"
}
},
"status": "success",
"type": "index"
}
]
},
"user": "test_admin"
}
}