IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Put watch API
editPut watch API
editExecution
editGeneral information about the installed Watcher features can be retrieved
using the watcher()
method:
// you can also use the WatchSourceBuilder from org.elasticsearch.plugin:x-pack-core to create a watch programmatically BytesReference watch = new BytesArray("{ \n" + " \"trigger\": { \"schedule\": { \"interval\": \"10h\" } },\n" + " \"input\": { \"simple\": { \"foo\" : \"bar\" } },\n" + " \"actions\": { \"logme\": { \"logging\": { \"text\": \"{{ctx.payload}}\" } } }\n" + "}"); PutWatchRequest request = new PutWatchRequest("my_watch_id", watch, XContentType.JSON); request.setActive(false); PutWatchResponse response = client.watcher().putWatch(request, RequestOptions.DEFAULT);
Response
editThe returned PutWatchResponse
contains created
, id
,
and version
information.
Asynchronous execution
editThis request can be executed asynchronously:
The asynchronous method does not block and returns immediately. Once it is
completed the ActionListener
is called back using the onResponse
method
if the execution successfully completed or using the onFailure
method if
it failed.
A typical listener for PutWatchResponse
looks like: