stop-job.asciidoc 2.6 KB

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