stop-job.asciidoc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[rollup-stop-job]]
  4. === Stop Job API
  5. ++++
  6. <titleabbrev>Stop Job</titleabbrev>
  7. ++++
  8. experimental[]
  9. This API stops an existing, started rollup job. If the job does not exist an exception will be thrown.
  10. Stopping an already stopped job has no action.
  11. ==== Request
  12. `POST _xpack/rollup/job/<job_id>/_stop`
  13. //===== Description
  14. ==== Path Parameters
  15. `job_id` (required)::
  16. (string) Identifier for the job
  17. ==== Request Body
  18. There is no request body for the Stop Job API.
  19. ==== Authorization
  20. You must have `manage` or `manage_rollup` cluster privileges to use this API.
  21. For more information, see
  22. {xpack-ref}/security-privileges.html[Security Privileges].
  23. ==== Examples
  24. If we have an already-started rollup job named `sensor`, it can be stopped with:
  25. [source,js]
  26. --------------------------------------------------
  27. POST _xpack/rollup/job/sensor/_stop
  28. --------------------------------------------------
  29. // CONSOLE
  30. // TEST[setup:sensor_started_rollup_job]
  31. Which will return the response:
  32. [source,js]
  33. ----
  34. {
  35. "stopped": true
  36. }
  37. ----
  38. // TESTRESPONSE
  39. If however we try to stop a job which doesn't exist:
  40. [source,js]
  41. --------------------------------------------------
  42. POST _xpack/rollup/job/does_not_exist/_stop
  43. --------------------------------------------------
  44. // CONSOLE
  45. // TEST[catch:missing]
  46. A 404 `resource_not_found` exception will be thrown:
  47. [source,js]
  48. ----
  49. {
  50. "error" : {
  51. "root_cause" : [
  52. {
  53. "type" : "resource_not_found_exception",
  54. "reason" : "Task for Rollup Job [does_not_exist] not found",
  55. "stack_trace": ...
  56. }
  57. ],
  58. "type" : "resource_not_found_exception",
  59. "reason" : "Task for Rollup Job [does_not_exist] not found",
  60. "stack_trace": ...
  61. },
  62. "status": 404
  63. }
  64. ----
  65. // TESTRESPONSE[s/"stack_trace": .../"stack_trace": $body.$_path/]