stopping-ml.asciidoc 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. [role="xpack"]
  2. [[stopping-ml]]
  3. == Stopping {ml} {anomaly-detect}
  4. An orderly shutdown ensures that:
  5. * {dfeeds-cap} are stopped
  6. * Buffers are flushed
  7. * Model history is pruned
  8. * Final results are calculated
  9. * Model snapshots are saved
  10. * {anomaly-jobs-cap} are closed
  11. This process ensures that jobs are in a consistent state in case you want to
  12. subsequently re-open them.
  13. [float]
  14. [[stopping-ml-datafeeds]]
  15. === Stopping {dfeeds}
  16. When you stop a {dfeed}, it ceases to retrieve data from {es}. You can stop a
  17. {dfeed} by using {kib} or the
  18. {ref}/ml-stop-datafeed.html[stop {dfeeds} API]. For example, the following
  19. request stops the `feed1` {dfeed}:
  20. [source,console]
  21. --------------------------------------------------
  22. POST _ml/datafeeds/feed1/_stop
  23. --------------------------------------------------
  24. // TEST[skip:setup:server_metrics_startdf]
  25. NOTE: You must have `manage_ml`, or `manage` cluster privileges to stop {dfeeds}.
  26. For more information, see {ref}/security-privileges.html[Security privileges]
  27. A {dfeed} can be started and stopped multiple times throughout its lifecycle.
  28. //For examples of stopping {dfeeds} in {kib}, see <<ml-gs-job1-manage>>.
  29. [float]
  30. [[stopping-all-ml-datafeeds]]
  31. ==== Stopping all {dfeeds}
  32. If you are upgrading your cluster, you can use the following request to stop all
  33. {dfeeds}:
  34. [source,console]
  35. ----------------------------------
  36. POST _ml/datafeeds/_all/_stop
  37. ----------------------------------
  38. // TEST[skip:needs-licence]
  39. [float]
  40. [[closing-ml-jobs]]
  41. === Closing {anomaly-jobs}
  42. When you close an {anomaly-job}, it cannot receive data or perform analysis
  43. operations. If a job is associated with a {dfeed}, you must stop the {dfeed}
  44. before you can close the job. If the {dfeed} has an end date, the job closes
  45. automatically on that end date.
  46. You can close a job by using the
  47. {ref}/ml-close-job.html[close {anomaly-job} API]. For
  48. example, the following request closes the `job1` job:
  49. [source,console]
  50. --------------------------------------------------
  51. POST _ml/anomaly_detectors/job1/_close
  52. --------------------------------------------------
  53. // TEST[skip:setup:server_metrics_openjob]
  54. NOTE: You must have `manage_ml`, or `manage` cluster privileges to stop {dfeeds}.
  55. For more information, see {ref}/security-privileges.html[Security privileges]
  56. {anomaly-jobs-cap} can be opened and closed multiple times throughout their
  57. lifecycle.
  58. [float]
  59. [[closing-all-ml-datafeeds]]
  60. ==== Closing all {anomaly-jobs}
  61. If you are upgrading your cluster, you can use the following request to close
  62. all open {anomaly-jobs} on the cluster:
  63. [source,console]
  64. ----------------------------------
  65. POST _ml/anomaly_detectors/_all/_close
  66. ----------------------------------
  67. // TEST[skip:needs-licence]