Skip to content

Commit a6c5b68

Browse files
authored
Small fixes to the HLRC watcher documentation. (#34306)
* Make sure to use the new docs style for 'ack watch'. * Replace 'document' with 'watcher' in page names.
1 parent 09aaed4 commit a6c5b68

File tree

3 files changed

+19
-35
lines changed

3 files changed

+19
-35
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/WatcherDocumentationIT.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,12 @@ public void testAckWatch() throws Exception {
162162
}
163163

164164
{
165-
//tag::ack-watch-execute
165+
//tag::ack-watch-request
166166
AckWatchRequest request = new AckWatchRequest("my_watch_id", // <1>
167167
"logme", "emailme"); // <2>
168+
//end::ack-watch-request
169+
170+
//tag::ack-watch-execute
168171
AckWatchResponse response = client.watcher().ackWatch(request, RequestOptions.DEFAULT);
169172
//end::ack-watch-execute
170173

docs/java-rest/high-level/supported-apis.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,14 @@ include::security/change-password.asciidoc[]
310310

311311
== Watcher APIs
312312

313-
:upid: {mainid}-document
313+
:upid: {mainid}-watcher
314314
:doc-tests-file: {doc-tests}/WatcherDocumentationIT.java
315315

316316
The Java High Level REST Client supports the following Watcher APIs:
317317

318318
* <<java-rest-high-x-pack-watcher-put-watch>>
319319
* <<java-rest-high-x-pack-watcher-delete-watch>>
320-
* <<java-rest-high-watcher-ack-watch>>
320+
* <<{upid}-ack-watch>>
321321
* <<{upid}-activate-watch>>
322322

323323
include::watcher/put-watch.asciidoc[]
Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
[[java-rest-high-watcher-ack-watch]]
1+
--
2+
:api: ack-watch
3+
:request: AckWatchRequest
4+
:response: AckWatchResponse
5+
--
6+
7+
[id="{upid}-{api}"]
28
=== Ack Watch API
39

4-
[[java-rest-high-watcher-ack-watch-execution]]
10+
[id="{upid}-{api}-request"]
511
==== Execution
612

713
{xpack-ref}/actions.html#actions-ack-throttle[Acknowledging a watch] enables you
@@ -10,48 +16,23 @@ through the following request:
1016

1117
["source","java",subs="attributes,callouts,macros"]
1218
--------------------------------------------------
13-
include-tagged::{doc-tests}/WatcherDocumentationIT.java[ack-watch-execute]
19+
include-tagged::{doc-tests-file}[{api}-request]
1420
--------------------------------------------------
1521
<1> The ID of the watch to ack.
1622
<2> An optional list of IDs representing the watch actions that should be acked.
1723
If no action IDs are provided, then all of the watch's actions will be acked.
1824

19-
[[java-rest-high-watcher-ack-watch-response]]
25+
[id="{upid}-{api}-response"]
2026
==== Response
2127

22-
The returned `AckWatchResponse` contains the new status of the requested watch:
28+
The returned +{response}+ contains the new status of the requested watch:
2329

2430
["source","java",subs="attributes,callouts,macros"]
2531
--------------------------------------------------
26-
include-tagged::{doc-tests}/WatcherDocumentationIT.java[ack-watch-response]
32+
include-tagged::{doc-tests-file}[{api}-response]
2733
--------------------------------------------------
2834
<1> The status of a specific action that was acked.
2935
<2> The acknowledgement state of the action. If the action was successfully
3036
acked, this state will be equal to `AckStatus.State.ACKED`.
3137

32-
[[java-rest-high-watcher-ack-watch-async]]
33-
==== Asynchronous Execution
34-
35-
This request can be executed asynchronously:
36-
37-
["source","java",subs="attributes,callouts,macros"]
38-
--------------------------------------------------
39-
include-tagged::{doc-tests}/WatcherDocumentationIT.java[ack-watch-execute-async]
40-
--------------------------------------------------
41-
<1> The `AckWatchRequest` to execute and the `ActionListener` to use when
42-
the execution completes.
43-
44-
The asynchronous method does not block and returns immediately. Once the request
45-
completes, the `ActionListener` is called back using the `onResponse` method
46-
if the execution successfully completed or using the `onFailure` method if
47-
it failed.
48-
49-
A listener for `AckWatchResponse` can be constructed as follows:
50-
51-
["source","java",subs="attributes,callouts,macros"]
52-
--------------------------------------------------
53-
include-tagged::{doc-tests}/WatcherDocumentationIT.java[ack-watch-execute-listener]
54-
--------------------------------------------------
55-
<1> Called when the execution is successfully completed. The response is
56-
provided as an argument.
57-
<2> Called in case of failure. The raised exception is provided as an argument.
38+
include::../execution.asciidoc[]

0 commit comments

Comments
 (0)