Class ElasticsearchWatcherClient
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Field Summary
Fields inherited from class co.elastic.clients.ApiClient
transport, transportOptions -
Constructor Summary
ConstructorsConstructorDescriptionElasticsearchWatcherClient(ElasticsearchTransport transport) ElasticsearchWatcherClient(ElasticsearchTransport transport, TransportOptions transportOptions) -
Method Summary
Modifier and TypeMethodDescriptionackWatch(AckWatchRequest request) Acknowledge a watch.final AckWatchResponseAcknowledge a watch.activateWatch(ActivateWatchRequest request) Activate a watch.final ActivateWatchResponseActivate a watch.deactivateWatch(DeactivateWatchRequest request) Deactivate a watch.final DeactivateWatchResponseDeactivate a watch.deleteWatch(DeleteWatchRequest request) Delete a watch.final DeleteWatchResponseDelete a watch.Run a watch.executeWatch(ExecuteWatchRequest request) Run a watch.final ExecuteWatchResponseRun a watch.Get Watcher index settings.getSettings(GetWatcherSettingsRequest request) Get Watcher index settings.getSettings(Function<GetWatcherSettingsRequest.Builder, ObjectBuilder<GetWatcherSettingsRequest>> fn) Get Watcher index settings.getWatch(GetWatchRequest request) Get a watch.final GetWatchResponseGet a watch.putWatch(PutWatchRequest request) Create or update a watch.final PutWatchResponseCreate or update a watch.Query watches.queryWatches(QueryWatchesRequest request) Query watches.final QueryWatchesResponseQuery watches.start()Start the watch service.start(StartWatcherRequest request) Start the watch service.final StartWatcherResponseStart the watch service.stats()Get Watcher statistics.stats(WatcherStatsRequest request) Get Watcher statistics.final WatcherStatsResponseGet Watcher statistics.stop()Stop the watch service.stop(StopWatcherRequest request) Stop the watch service.final StopWatcherResponseStop the watch service.Update Watcher index settings.updateSettings(UpdateSettingsRequest request) Update Watcher index settings.final UpdateSettingsResponseUpdate Watcher index settings.withTransportOptions(TransportOptions transportOptions) Creates a new client with some request optionsMethods inherited from class co.elastic.clients.ApiClient
_jsonpMapper, _transport, _transportOptions, close, getDeserializer, withTransportOptions
-
Constructor Details
-
ElasticsearchWatcherClient
-
ElasticsearchWatcherClient
public ElasticsearchWatcherClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions)
-
-
Method Details
-
withTransportOptions
Description copied from class:ApiClientCreates a new client with some request options- Specified by:
withTransportOptionsin classApiClient<ElasticsearchTransport,ElasticsearchWatcherClient>
-
ackWatch
public AckWatchResponse ackWatch(AckWatchRequest request) throws IOException, ElasticsearchException 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.statestructure.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.stateis reset toawaits_successful_execution. This happens when the condition of the watch is not met (the condition evaluates to false). To demonstrate how throttling works in practice and how it can be configured for individual actions within a watch, refer to External documentation.- Throws:
IOExceptionElasticsearchException- See Also:
-
ackWatch
public final AckWatchResponse ackWatch(Function<AckWatchRequest.Builder, ObjectBuilder<AckWatchRequest>> fn) throws IOException, ElasticsearchExceptionAcknowledge 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.statestructure.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.stateis reset toawaits_successful_execution. This happens when the condition of the watch is not met (the condition evaluates to false). To demonstrate how throttling works in practice and how it can be configured for individual actions within a watch, refer to External documentation.- Parameters:
fn- a function that initializes a builder to create theAckWatchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
activateWatch
public ActivateWatchResponse activateWatch(ActivateWatchRequest request) throws IOException, ElasticsearchException Activate a watch. A watch can be either active or inactive.- Throws:
IOExceptionElasticsearchException- See Also:
-
activateWatch
public final ActivateWatchResponse activateWatch(Function<ActivateWatchRequest.Builder, ObjectBuilder<ActivateWatchRequest>> fn) throws IOException, ElasticsearchExceptionActivate a watch. A watch can be either active or inactive.- Parameters:
fn- a function that initializes a builder to create theActivateWatchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
deactivateWatch
public DeactivateWatchResponse deactivateWatch(DeactivateWatchRequest request) throws IOException, ElasticsearchException Deactivate a watch. A watch can be either active or inactive.- Throws:
IOExceptionElasticsearchException- See Also:
-
deactivateWatch
public final DeactivateWatchResponse deactivateWatch(Function<DeactivateWatchRequest.Builder, ObjectBuilder<DeactivateWatchRequest>> fn) throws IOException, ElasticsearchExceptionDeactivate a watch. A watch can be either active or inactive.- Parameters:
fn- a function that initializes a builder to create theDeactivateWatchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
deleteWatch
public DeleteWatchResponse deleteWatch(DeleteWatchRequest request) throws IOException, ElasticsearchException Delete a watch. When the watch is removed, the document representing the watch in the.watchesindex 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
.watchesindex using the Elasticsearch delete document API When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the.watchesindex.- Throws:
IOExceptionElasticsearchException- See Also:
-
deleteWatch
public final DeleteWatchResponse deleteWatch(Function<DeleteWatchRequest.Builder, ObjectBuilder<DeleteWatchRequest>> fn) throws IOException, ElasticsearchExceptionDelete a watch. When the watch is removed, the document representing the watch in the.watchesindex 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
.watchesindex using the Elasticsearch delete document API When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the.watchesindex.- Parameters:
fn- a function that initializes a builder to create theDeleteWatchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
executeWatch
public ExecuteWatchResponse executeWatch(ExecuteWatchRequest request) throws IOException, ElasticsearchException 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 indexb, 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. Refer to the external documentation for examples of watch execution requests, including existing, customized, and inline watches.
- Throws:
IOExceptionElasticsearchException- See Also:
-
executeWatch
public final ExecuteWatchResponse executeWatch(Function<ExecuteWatchRequest.Builder, ObjectBuilder<ExecuteWatchRequest>> fn) throws IOException, ElasticsearchExceptionRun 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 indexb, 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. Refer to the external documentation for examples of watch execution requests, including existing, customized, and inline watches.
- Parameters:
fn- a function that initializes a builder to create theExecuteWatchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
executeWatch
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 indexb, 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. Refer to the external documentation for examples of watch execution requests, including existing, customized, and inline watches.
- Throws:
IOExceptionElasticsearchException- See Also:
-
getSettings
public GetWatcherSettingsResponse getSettings(GetWatcherSettingsRequest request) throws IOException, ElasticsearchException Get Watcher index settings. Get settings for the Watcher internal index (.watches). Only a subset of settings are shown, for exampleindex.auto_expand_replicasandindex.number_of_replicas.- Throws:
IOExceptionElasticsearchException- See Also:
-
getSettings
public final GetWatcherSettingsResponse getSettings(Function<GetWatcherSettingsRequest.Builder, ObjectBuilder<GetWatcherSettingsRequest>> fn) throws IOException, ElasticsearchExceptionGet Watcher index settings. Get settings for the Watcher internal index (.watches). Only a subset of settings are shown, for exampleindex.auto_expand_replicasandindex.number_of_replicas.- Parameters:
fn- a function that initializes a builder to create theGetWatcherSettingsRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
getSettings
Get Watcher index settings. Get settings for the Watcher internal index (.watches). Only a subset of settings are shown, for exampleindex.auto_expand_replicasandindex.number_of_replicas.- Throws:
IOExceptionElasticsearchException- See Also:
-
getWatch
public GetWatchResponse getWatch(GetWatchRequest request) throws IOException, ElasticsearchException Get a watch.- Throws:
IOExceptionElasticsearchException- See Also:
-
getWatch
public final GetWatchResponse getWatch(Function<GetWatchRequest.Builder, ObjectBuilder<GetWatchRequest>> fn) throws IOException, ElasticsearchExceptionGet a watch.- Parameters:
fn- a function that initializes a builder to create theGetWatchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
putWatch
public PutWatchResponse putWatch(PutWatchRequest request) throws IOException, ElasticsearchException Create or update a watch. When a watch is registered, a new document that represents the watch is added to the.watchesindex and its trigger is immediately registered with the relevant trigger engine. Typically for thescheduletrigger, 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
.watchesindex by using the Elasticsearch index API. If Elasticsearch security features are enabled, do not give users write privileges on the.watchesindex.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 indexb, the same will apply when the watch runs.- Throws:
IOExceptionElasticsearchException- See Also:
-
putWatch
public final PutWatchResponse putWatch(Function<PutWatchRequest.Builder, ObjectBuilder<PutWatchRequest>> fn) throws IOException, ElasticsearchExceptionCreate or update a watch. When a watch is registered, a new document that represents the watch is added to the.watchesindex and its trigger is immediately registered with the relevant trigger engine. Typically for thescheduletrigger, 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
.watchesindex by using the Elasticsearch index API. If Elasticsearch security features are enabled, do not give users write privileges on the.watchesindex.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 indexb, the same will apply when the watch runs.- Parameters:
fn- a function that initializes a builder to create thePutWatchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
queryWatches
public QueryWatchesResponse queryWatches(QueryWatchesRequest request) throws IOException, ElasticsearchException Query watches. Get all registered watches in a paginated manner and optionally filter watches by a query.Note that only the
_idandmetadata.*fields are queryable or sortable.- Throws:
IOExceptionElasticsearchException- See Also:
-
queryWatches
public final QueryWatchesResponse queryWatches(Function<QueryWatchesRequest.Builder, ObjectBuilder<QueryWatchesRequest>> fn) throws IOException, ElasticsearchExceptionQuery watches. Get all registered watches in a paginated manner and optionally filter watches by a query.Note that only the
_idandmetadata.*fields are queryable or sortable.- Parameters:
fn- a function that initializes a builder to create theQueryWatchesRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
queryWatches
Query watches. Get all registered watches in a paginated manner and optionally filter watches by a query.Note that only the
_idandmetadata.*fields are queryable or sortable.- Throws:
IOExceptionElasticsearchException- See Also:
-
start
public StartWatcherResponse start(StartWatcherRequest request) throws IOException, ElasticsearchException Start the watch service. Start the Watcher service if it is not already running.- Throws:
IOExceptionElasticsearchException- See Also:
-
start
public final StartWatcherResponse start(Function<StartWatcherRequest.Builder, ObjectBuilder<StartWatcherRequest>> fn) throws IOException, ElasticsearchExceptionStart the watch service. Start the Watcher service if it is not already running.- Parameters:
fn- a function that initializes a builder to create theStartWatcherRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
start
Start the watch service. Start the Watcher service if it is not already running.- Throws:
IOExceptionElasticsearchException- See Also:
-
stats
public WatcherStatsResponse stats(WatcherStatsRequest request) throws IOException, ElasticsearchException Get Watcher statistics. This API always returns basic metrics. You retrieve more metrics by using the metric parameter.- Throws:
IOExceptionElasticsearchException- See Also:
-
stats
public final WatcherStatsResponse stats(Function<WatcherStatsRequest.Builder, ObjectBuilder<WatcherStatsRequest>> fn) throws IOException, ElasticsearchExceptionGet Watcher statistics. This API always returns basic metrics. You retrieve more metrics by using the metric parameter.- Parameters:
fn- a function that initializes a builder to create theWatcherStatsRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
stats
Get Watcher statistics. This API always returns basic metrics. You retrieve more metrics by using the metric parameter.- Throws:
IOExceptionElasticsearchException- See Also:
-
stop
public StopWatcherResponse stop(StopWatcherRequest request) throws IOException, ElasticsearchException Stop the watch service. Stop the Watcher service if it is running.- Throws:
IOExceptionElasticsearchException- See Also:
-
stop
public final StopWatcherResponse stop(Function<StopWatcherRequest.Builder, ObjectBuilder<StopWatcherRequest>> fn) throws IOException, ElasticsearchExceptionStop the watch service. Stop the Watcher service if it is running.- Parameters:
fn- a function that initializes a builder to create theStopWatcherRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
stop
Stop the watch service. Stop the Watcher service if it is running.- Throws:
IOExceptionElasticsearchException- See Also:
-
updateSettings
public UpdateSettingsResponse updateSettings(UpdateSettingsRequest request) throws IOException, ElasticsearchException Update Watcher index settings. Update settings for the Watcher internal index (.watches). Only a subset of settings can be modified. This includesindex.auto_expand_replicas,index.number_of_replicas,index.routing.allocation.exclude.*,index.routing.allocation.include.*andindex.routing.allocation.require.*. Modification ofindex.routing.allocation.include._tier_preferenceis an exception and is not allowed as the Watcher shards must always be in thedata_contenttier.- Throws:
IOExceptionElasticsearchException- See Also:
-
updateSettings
public final UpdateSettingsResponse updateSettings(Function<UpdateSettingsRequest.Builder, ObjectBuilder<UpdateSettingsRequest>> fn) throws IOException, ElasticsearchExceptionUpdate Watcher index settings. Update settings for the Watcher internal index (.watches). Only a subset of settings can be modified. This includesindex.auto_expand_replicas,index.number_of_replicas,index.routing.allocation.exclude.*,index.routing.allocation.include.*andindex.routing.allocation.require.*. Modification ofindex.routing.allocation.include._tier_preferenceis an exception and is not allowed as the Watcher shards must always be in thedata_contenttier.- Parameters:
fn- a function that initializes a builder to create theUpdateSettingsRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
updateSettings
Update Watcher index settings. Update settings for the Watcher internal index (.watches). Only a subset of settings can be modified. This includesindex.auto_expand_replicas,index.number_of_replicas,index.routing.allocation.exclude.*,index.routing.allocation.include.*andindex.routing.allocation.require.*. Modification ofindex.routing.allocation.include._tier_preferenceis an exception and is not allowed as the Watcher shards must always be in thedata_contenttier.- Throws:
IOExceptionElasticsearchException- See Also:
-