stop-job.asciidoc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. [role="xpack"]
  2. [[rollup-stop-job]]
  3. === Stop {rollup-jobs} API
  4. [subs="attributes"]
  5. ++++
  6. <titleabbrev>Stop {rollup-jobs}</titleabbrev>
  7. ++++
  8. Stops an existing, started {rollup-job}.
  9. experimental[]
  10. [[rollup-stop-job-request]]
  11. ==== {api-request-title}
  12. `POST _rollup/job/<job_id>/_stop`
  13. [[rollup-stop-job-prereqs]]
  14. ==== {api-prereq-title}
  15. * If the {es} {security-features} are enabled, you must have `manage` or
  16. `manage_rollup` cluster privileges to use this API. For more information, see
  17. <<security-privileges>>.
  18. [[rollup-stop-job-desc]]
  19. ===== {api-description-title}
  20. If you try to stop a job that does not exist, an exception occurs. If you try
  21. to stop a job that is already stopped, nothing happens.
  22. [[rollup-stop-job-path-parms]]
  23. ==== {api-path-parms-title}
  24. `<job_id>`::
  25. (Required, string) Identifier for the {rollup-job}.
  26. [[rollup-stop-job-query-parms]]
  27. ==== {api-query-parms-title}
  28. `timeout`::
  29. (Optional, TimeValue) If `wait_for_completion` is `true`, the API blocks for
  30. (at maximum) the specified duration while waiting for the job to stop. If more
  31. than `timeout` time has passed, the API throws a timeout exception. Defaults
  32. to `30s`.
  33. +
  34. --
  35. NOTE: Even if a timeout exception is thrown, the stop request is still
  36. processing and eventually moves the job to `STOPPED`. The timeout simply means
  37. the API call itself timed out while waiting for the status change.
  38. --
  39. `wait_for_completion`::
  40. (Optional, Boolean) If set to `true`, causes the API to block until the
  41. indexer state completely stops. If set to `false`, the API returns immediately
  42. and the indexer is stopped asynchronously in the background. Defaults to
  43. `false`.
  44. [[rollup-stop-job-response-codes]]
  45. ==== {api-response-codes-title}
  46. `404` (Missing resources)::
  47. This code indicates that there are no resources that match the request. It
  48. occurs if you try to stop a job that doesn't exist.
  49. [[rollup-stop-job-examples]]
  50. ==== {api-examples-title}
  51. Since only a stopped job can be deleted, it can be useful to block the API until
  52. the indexer has fully stopped. This is accomplished with the
  53. `wait_for_completion` query parameter, and optionally a `timeout`:
  54. [source,console]
  55. --------------------------------------------------
  56. POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s
  57. --------------------------------------------------
  58. // TEST[setup:sensor_started_rollup_job]
  59. The parameter blocks the API call from returning until either the job has moved
  60. to `STOPPED` or the specified time has elapsed. If the specified time elapses
  61. without the job moving to `STOPPED`, a timeout exception is thrown.