Files
elasticsearch-js/docs/reference/api/Watcher.md
2025-05-27 16:07:27 -05:00

16 KiB

Watcher

Constructor

::: new Watcher(transport: Transport); :::

Properties

Name Type Description
acceptedParams Record<string, { path: string[]; body: string[]; query: string[]; }>  
transport Transport  

Methods

Name Signature Description
ackWatch ackWatch(this: [That](./That.md), params: [WatcherAckWatchRequest](./WatcherAckWatchRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherAckWatchResponse](./WatcherAckWatchResponse.md)>; Acknowledge a watch. Acknowledging a watch enables you to manually throttle the execution of the watch's actions. The acknowledgement state of an action is stored in the status.actions.<id>.ack.state structure. IMPORTANT: If the specified watch is currently being executed, this API will return an error The reason for this behavior is to prevent overwriting the watch status from a watch execution. Acknowledging an action throttles further executions of that action until its ack.state is reset to awaits_successful_execution. This happens when the condition of the watch is not met (the condition evaluates to false).
ackWatch ackWatch(this: [That](./That.md), params: [WatcherAckWatchRequest](./WatcherAckWatchRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherAckWatchResponse](./WatcherAckWatchResponse.md), unknown>>;  
ackWatch ackWatch(this: [That](./That.md), params: [WatcherAckWatchRequest](./WatcherAckWatchRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherAckWatchResponse](./WatcherAckWatchResponse.md)>;  
activateWatch activateWatch(this: [That](./That.md), params: [WatcherActivateWatchRequest](./WatcherActivateWatchRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherActivateWatchResponse](./WatcherActivateWatchResponse.md)>; Activate a watch. A watch can be either active or inactive.
activateWatch activateWatch(this: [That](./That.md), params: [WatcherActivateWatchRequest](./WatcherActivateWatchRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherActivateWatchResponse](./WatcherActivateWatchResponse.md), unknown>>;  
activateWatch activateWatch(this: [That](./That.md), params: [WatcherActivateWatchRequest](./WatcherActivateWatchRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherActivateWatchResponse](./WatcherActivateWatchResponse.md)>;  
deactivateWatch deactivateWatch(this: [That](./That.md), params: [WatcherDeactivateWatchRequest](./WatcherDeactivateWatchRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherDeactivateWatchResponse](./WatcherDeactivateWatchResponse.md)>; Deactivate a watch. A watch can be either active or inactive.
deactivateWatch deactivateWatch(this: [That](./That.md), params: [WatcherDeactivateWatchRequest](./WatcherDeactivateWatchRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherDeactivateWatchResponse](./WatcherDeactivateWatchResponse.md), unknown>>;  
deactivateWatch deactivateWatch(this: [That](./That.md), params: [WatcherDeactivateWatchRequest](./WatcherDeactivateWatchRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherDeactivateWatchResponse](./WatcherDeactivateWatchResponse.md)>;  
deleteWatch deleteWatch(this: [That](./That.md), params: [WatcherDeleteWatchRequest](./WatcherDeleteWatchRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherDeleteWatchResponse](./WatcherDeleteWatchResponse.md)>; Delete a watch. When the watch is removed, the document representing the watch in the .watches index is gone and it will never be run again. Deleting a watch does not delete any watch execution records related to this watch from the watch history. IMPORTANT: Deleting a watch must be done by using only this API. Do not delete the watch directly from the .watches index using the Elasticsearch delete document API When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the .watches index.
deleteWatch deleteWatch(this: [That](./That.md), params: [WatcherDeleteWatchRequest](./WatcherDeleteWatchRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherDeleteWatchResponse](./WatcherDeleteWatchResponse.md), unknown>>;  
deleteWatch deleteWatch(this: [That](./That.md), params: [WatcherDeleteWatchRequest](./WatcherDeleteWatchRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherDeleteWatchResponse](./WatcherDeleteWatchResponse.md)>;  
executeWatch executeWatch(this: [That](./That.md), params?: [WatcherExecuteWatchRequest](./WatcherExecuteWatchRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherExecuteWatchResponse](./WatcherExecuteWatchResponse.md)>; 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.
executeWatch executeWatch(this: [That](./That.md), params?: [WatcherExecuteWatchRequest](./WatcherExecuteWatchRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherExecuteWatchResponse](./WatcherExecuteWatchResponse.md), unknown>>;  
executeWatch executeWatch(this: [That](./That.md), params?: [WatcherExecuteWatchRequest](./WatcherExecuteWatchRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherExecuteWatchResponse](./WatcherExecuteWatchResponse.md)>;  
getSettings getSettings(this: [That](./That.md), params?: [WatcherGetSettingsRequest](./WatcherGetSettingsRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherGetSettingsResponse](./WatcherGetSettingsResponse.md)>; Get Watcher index settings. Get settings for the Watcher internal index ( .watches). Only a subset of settings are shown, for example index.auto_expand_replicas and index.number_of_replicas.
getSettings getSettings(this: [That](./That.md), params?: [WatcherGetSettingsRequest](./WatcherGetSettingsRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherGetSettingsResponse](./WatcherGetSettingsResponse.md), unknown>>;  
getSettings getSettings(this: [That](./That.md), params?: [WatcherGetSettingsRequest](./WatcherGetSettingsRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherGetSettingsResponse](./WatcherGetSettingsResponse.md)>;  
getWatch getWatch(this: [That](./That.md), params: [WatcherGetWatchRequest](./WatcherGetWatchRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherGetWatchResponse](./WatcherGetWatchResponse.md)>; Get a watch.
getWatch getWatch(this: [That](./That.md), params: [WatcherGetWatchRequest](./WatcherGetWatchRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherGetWatchResponse](./WatcherGetWatchResponse.md), unknown>>;  
getWatch getWatch(this: [That](./That.md), params: [WatcherGetWatchRequest](./WatcherGetWatchRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherGetWatchResponse](./WatcherGetWatchResponse.md)>;  
putWatch putWatch(this: [That](./That.md), params: [WatcherPutWatchRequest](./WatcherPutWatchRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherPutWatchResponse](./WatcherPutWatchResponse.md)>; Create or update a watch. When a watch is registered, a new document that represents the watch is added to the .watches index and its trigger is immediately registered with the relevant trigger engine. Typically for the schedule trigger, the scheduler is the trigger engine. IMPORTANT: You must use Kibana or this API to create a watch. Do not add a watch directly to the .watches index by using the Elasticsearch index API. If Elasticsearch security features are enabled, do not give users write privileges on the .watches index. When you add a watch you can also define its initial active state by setting the active parameter. When Elasticsearch security features are enabled, your watch can index or search only on indices for which the user that stored the watch has privileges. If the user is able to read index a, but not index b, the same will apply when the watch runs.
putWatch putWatch(this: [That](./That.md), params: [WatcherPutWatchRequest](./WatcherPutWatchRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherPutWatchResponse](./WatcherPutWatchResponse.md), unknown>>;  
putWatch putWatch(this: [That](./That.md), params: [WatcherPutWatchRequest](./WatcherPutWatchRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherPutWatchResponse](./WatcherPutWatchResponse.md)>;  
queryWatches queryWatches(this: [That](./That.md), params?: [WatcherQueryWatchesRequest](./WatcherQueryWatchesRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherQueryWatchesResponse](./WatcherQueryWatchesResponse.md)>; Query watches. Get all registered watches in a paginated manner and optionally filter watches by a query. Note that only the _id and metadata.* fields are queryable or sortable.
queryWatches queryWatches(this: [That](./That.md), params?: [WatcherQueryWatchesRequest](./WatcherQueryWatchesRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherQueryWatchesResponse](./WatcherQueryWatchesResponse.md), unknown>>;  
queryWatches queryWatches(this: [That](./That.md), params?: [WatcherQueryWatchesRequest](./WatcherQueryWatchesRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherQueryWatchesResponse](./WatcherQueryWatchesResponse.md)>;  
start start(this: [That](./That.md), params?: [WatcherStartRequest](./WatcherStartRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherStartResponse](./WatcherStartResponse.md)>; Start the watch service. Start the Watcher service if it is not already running.
start start(this: [That](./That.md), params?: [WatcherStartRequest](./WatcherStartRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherStartResponse](./WatcherStartResponse.md), unknown>>;  
start start(this: [That](./That.md), params?: [WatcherStartRequest](./WatcherStartRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherStartResponse](./WatcherStartResponse.md)>;  
stats stats(this: [That](./That.md), params?: [WatcherStatsRequest](./WatcherStatsRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherStatsResponse](./WatcherStatsResponse.md)>; Get Watcher statistics. This API always returns basic metrics. You retrieve more metrics by using the metric parameter.
stats stats(this: [That](./That.md), params?: [WatcherStatsRequest](./WatcherStatsRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherStatsResponse](./WatcherStatsResponse.md), unknown>>;  
stats stats(this: [That](./That.md), params?: [WatcherStatsRequest](./WatcherStatsRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherStatsResponse](./WatcherStatsResponse.md)>;  
stop stop(this: [That](./That.md), params?: [WatcherStopRequest](./WatcherStopRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherStopResponse](./WatcherStopResponse.md)>; Stop the watch service. Stop the Watcher service if it is running.
stop stop(this: [That](./That.md), params?: [WatcherStopRequest](./WatcherStopRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherStopResponse](./WatcherStopResponse.md), unknown>>;  
stop stop(this: [That](./That.md), params?: [WatcherStopRequest](./WatcherStopRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherStopResponse](./WatcherStopResponse.md)>;  
updateSettings updateSettings(this: [That](./That.md), params?: [WatcherUpdateSettingsRequest](./WatcherUpdateSettingsRequest.md), options?: [TransportRequestOptionsWithOutMeta](./TransportRequestOptionsWithOutMeta.md)): Promise<[WatcherUpdateSettingsResponse](./WatcherUpdateSettingsResponse.md)>; Update Watcher index settings. Update settings for the Watcher internal index ( .watches). Only a subset of settings can be modified. This includes index.auto_expand_replicas, index.number_of_replicas, index.routing.allocation.exclude.*, index.routing.allocation.include.* and index.routing.allocation.require.*. Modification of index.routing.allocation.include._tier_preference is an exception and is not allowed as the Watcher shards must always be in the data_content tier.
updateSettings updateSettings(this: [That](./That.md), params?: [WatcherUpdateSettingsRequest](./WatcherUpdateSettingsRequest.md), options?: [TransportRequestOptionsWithMeta](./TransportRequestOptionsWithMeta.md)): Promise<[TransportResult](./TransportResult.md)<[WatcherUpdateSettingsResponse](./WatcherUpdateSettingsResponse.md), unknown>>;  
updateSettings updateSettings(this: [That](./That.md), params?: [WatcherUpdateSettingsRequest](./WatcherUpdateSettingsRequest.md), options?: [TransportRequestOptions](./TransportRequestOptions.md)): Promise<[WatcherUpdateSettingsResponse](./WatcherUpdateSettingsResponse.md)>;