-
Notifications
You must be signed in to change notification settings - Fork 25.6k
HLRC: Add delete watch action #32337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
3c860e4
c3fcd7d
28780bc
07240ce
2129e4e
a8b0423
3f2cd11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| [[java-rest-high-x-pack-watcher-delete-watch]] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i spent zero time researching, but the doc build fails on your commit using the following
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, I've pushed a8b0423 which fixes the copy-paste error (I've tested it also by running your command). I've also added the put-watch and delete-watch action to the actual page (and not only right-hand-side table of contents).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. excellent |
||
| === X-Pack Delete Watch API | ||
|
|
||
| [[java-rest-high-x-pack-watcher-delete-watch-execution]] | ||
| ==== Execution | ||
|
|
||
| A watch can be deleted as follows: | ||
|
|
||
| ["source","java",subs="attributes,callouts,macros"] | ||
| -------------------------------------------------- | ||
| include-tagged::{doc-tests}/WatcherDocumentationIT.java[x-pack-delete-watch-execute] | ||
| -------------------------------------------------- | ||
|
|
||
| [[java-rest-high-x-pack-watcher-delete-watch-response]] | ||
| ==== Response | ||
|
|
||
| The returned `DeleteWatchResponse` contains `found`, `id`, | ||
| and `version` information. | ||
|
|
||
| ["source","java",subs="attributes,callouts,macros"] | ||
| -------------------------------------------------- | ||
| include-tagged::{doc-tests}/WatcherDocumentationIT.java[x-pack-put-watch-response] | ||
| -------------------------------------------------- | ||
| <1> `_id` contains id of the watch | ||
| <2> `found` is a boolean indicating whether the watch was found | ||
| <3> `_version` returns the version of the deleted watch | ||
|
|
||
| [[java-rest-high-x-pack-watcher-put-watch-async]] | ||
| ==== Asynchronous Execution | ||
|
|
||
| This request can be executed asynchronously: | ||
|
|
||
| ["source","java",subs="attributes,callouts,macros"] | ||
| -------------------------------------------------- | ||
| include-tagged::{doc-tests}/WatcherDocumentationIT.java[x-pack-delete-watch-execute-async] | ||
| -------------------------------------------------- | ||
| <1> The `DeleteWatchRequest` to execute and the `ActionListener` to use when | ||
| the execution completes | ||
|
|
||
| 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 `DeleteWatchResponse` looks like: | ||
|
|
||
| ["source","java",subs="attributes,callouts,macros"] | ||
| -------------------------------------------------- | ||
| include-tagged::{doc-tests}/WatcherDocumentationIT.java[x-pack-delete-watch-execute-listener] | ||
| -------------------------------------------------- | ||
| <1> Called when the execution is successfully completed. The response is | ||
| provided as an argument | ||
| <2> Called in case of failure. The raised exception is provided as an argument | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im curious as to why you set the ignores on a 404. This could be a 404 from the delete or from a bad license i believe. It makes we think maybe we should be handling the error for no license different from these 404's for the deleted object not being found. I havent seen this in a lot of the codebase, so im just wondering what the reasoning was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RestDeleteWatchActionreturns a 404 with a body if the deleted object is not found. It's a bit unusual, but yeah, if I didn't add this here, theRestHighLevelClientclass would puke all over itself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, ok. This is indeed fun.