[[reference-watcher-execute_watch]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////

[discrete]
=== client.watcher.executeWatch

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 execute the watch without executing 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 execution.

{ref}/watcher-api-execute-watch.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(WatcherExecuteWatchRequest, options?): Promise<WatcherExecuteWatchResponse>
----

[discrete]
==== WatcherExecuteWatchRequest

[pass]
++++
<pre>
++++
interface WatcherExecuteWatchRequest extends <<RequestBase>> {
  id?: <<Id>>
  debug?: boolean
  action_modes?: Record<string, WatcherActionExecutionMode>
  alternative_input?: Record<string, any>
  ignore_condition?: boolean
  record_execution?: boolean
  simulated_actions?: WatcherSimulatedActions
  trigger_data?: WatcherScheduleTriggerEvent
  watch?: WatcherWatch
}

[pass]
++++
</pre>
++++
[discrete]
==== WatcherExecuteWatchResponse

[pass]
++++
<pre>
++++
interface WatcherExecuteWatchResponse {
  _id: <<Id>>
  watch_record: WatcherExecuteWatchWatchRecord
}

[pass]
++++
</pre>
++++
