stop-datafeed.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. [[java-rest-high-x-pack-ml-stop-datafeed]]
  2. === Stop Datafeed API
  3. The Stop Datafeed API provides the ability to stop a {ml} datafeed in the cluster.
  4. It accepts a `StopDatafeedRequest` object and responds
  5. with a `StopDatafeedResponse` object.
  6. [[java-rest-high-x-pack-ml-stop-datafeed-request]]
  7. ==== Stop Datafeed Request
  8. A `StopDatafeedRequest` object is created referencing any number of non-null `datafeedId` entries.
  9. Wildcards and `_all` are also accepted.
  10. All other fields are optional for the request.
  11. ["source","java",subs="attributes,callouts,macros"]
  12. --------------------------------------------------
  13. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-stop-datafeed-request]
  14. --------------------------------------------------
  15. <1> Constructing a new request referencing existing `datafeedId` entries.
  16. ==== Optional Arguments
  17. The following arguments are optional.
  18. ["source","java",subs="attributes,callouts,macros"]
  19. --------------------------------------------------
  20. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-stop-datafeed-request-options]
  21. --------------------------------------------------
  22. <1> Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string)
  23. <2> If true, the datafeed is stopped forcefully.
  24. <3> Controls the amount of time to wait until a datafeed stops. The default value is 20 seconds.
  25. [[java-rest-high-x-pack-ml-stop-datafeed-execution]]
  26. ==== Execution
  27. The request can be executed through the `MachineLearningClient` contained
  28. in the `RestHighLevelClient` object, accessed via the `machineLearningClient()` method.
  29. ["source","java",subs="attributes,callouts,macros"]
  30. --------------------------------------------------
  31. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-stop-datafeed-execute]
  32. --------------------------------------------------
  33. <1> Did the datafeed successfully stop?
  34. [[java-rest-high-x-pack-ml-stop-datafeed-execution-async]]
  35. ==== Asynchronous Execution
  36. The request can also be executed asynchronously:
  37. ["source","java",subs="attributes,callouts,macros"]
  38. --------------------------------------------------
  39. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-stop-datafeed-execute-async]
  40. --------------------------------------------------
  41. <1> The `StopDatafeedRequest` to execute and the `ActionListener` to use when
  42. the execution completes
  43. The method does not block and returns immediately. The passed `ActionListener` is used
  44. to notify the caller of completion. A typical `ActionListener` for `StopDatafeedResponse` may
  45. look like
  46. ["source","java",subs="attributes,callouts,macros"]
  47. --------------------------------------------------
  48. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-stop-datafeed-listener]
  49. --------------------------------------------------
  50. <1> `onResponse` is called back when the action is completed successfully
  51. <2> `onFailure` is called back when some unexpected error occurs