start-job.asciidoc 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[rollup-start-job]]
  4. === Start Job API
  5. ++++
  6. <titleabbrev>Start Job</titleabbrev>
  7. ++++
  8. experimental[]
  9. This API starts an existing, stopped rollup job. If the job does not exist an exception will be thrown.
  10. Starting an already started job has no action.
  11. ==== Request
  12. `POST _xpack/rollup/job/<job_id>/_start`
  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 Start 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 already created a rollup job named `sensor`, it can be started with:
  25. [source,js]
  26. --------------------------------------------------
  27. POST _xpack/rollup/job/sensor/_start
  28. --------------------------------------------------
  29. // CONSOLE
  30. // TEST[setup:sensor_rollup_job]
  31. Which will return the response:
  32. [source,js]
  33. ----
  34. {
  35. "started": true
  36. }
  37. ----
  38. // TESTRESPONSE
  39. If however we try to start a job which doesn't exist:
  40. [source,js]
  41. --------------------------------------------------
  42. POST _xpack/rollup/job/does_not_exist/_start
  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/]