[[reference-watcher-put_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.putWatch]]
=== client.watcher.putWatch

Creates a new watch, or updates an existing one.

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

[discrete]
==== Function signature

[source,ts]
----
(WatcherPutWatchRequest, options?): Promise<WatcherPutWatchResponse>
----

[discrete]
==== Request

[pass]
++++
<pre>
++++
interface WatcherPutWatchRequest extends <<RequestBase>> {
  id: <<Id>>
  active?: boolean
  if_primary_term?: <<long>>
  if_seq_no?: <<SequenceNumber>>
  version?: <<VersionNumber>>
  actions?: Record<string, <<WatcherAction>>>
  condition?: <<WatcherConditionContainer>>
  input?: <<WatcherInputContainer>>
  metadata?: <<Metadata>>
  throttle_period?: string
  transform?: <<TransformContainer>>
  trigger?: <<WatcherTriggerContainer>>
}

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

[pass]
++++
<pre>
++++
interface WatcherPutWatchResponse {
  created: boolean
  _id: <<Id>>
  _primary_term: <<long>>
  _seq_no: <<SequenceNumber>>
  _version: <<VersionNumber>>
}

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