delete-job.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. [role="xpack"]
  2. [[rollup-delete-job]]
  3. === Delete Job API
  4. ++++
  5. <titleabbrev>Delete Job</titleabbrev>
  6. ++++
  7. experimental[]
  8. This API deletes an existing rollup job. The job can be started or stopped, in both cases it will be deleted. Attempting
  9. to delete a non-existing job will throw an exception
  10. .Deleting the job does not delete rolled up data
  11. **********************************
  12. When a job is deleted, that only removes the process that is actively monitoring and rolling up data.
  13. It does not delete any previously rolled up data. This is by design; a user may wish to roll up a static dataset. Because
  14. the dataset is static, once it has been fully rolled up there is no need to keep the indexing Rollup job around (as there
  15. will be no new data). So the job may be deleted, leaving behind the rolled up data for analysis.
  16. If you wish to also remove the rollup data, and the rollup index only contains the data for a single job, you can simply
  17. delete the whole rollup index. If the rollup index stores data from several jobs, you must issue a Delete-By-Query that
  18. targets the Rollup job's ID in the rollup index:
  19. [source,js]
  20. --------------------------------------------------
  21. POST my_rollup_index/_delete_by_query
  22. {
  23. "query": {
  24. "term": {
  25. "_rollup.id": "the_rollup_job_id"
  26. }
  27. }
  28. }
  29. --------------------------------------------------
  30. // NOTCONSOLE
  31. **********************************
  32. ==== Request
  33. `DELETE _xpack/rollup/job/<job_id>`
  34. //===== Description
  35. ==== Path Parameters
  36. `job_id` (required)::
  37. (string) Identifier for the job
  38. ==== Request Body
  39. There is no request body for the Delete Job API.
  40. ==== Authorization
  41. You must have `manage` or `manage_rollup` cluster privileges to use this API.
  42. For more information, see
  43. {xpack-ref}/security-privileges.html[Security Privileges].
  44. ==== Examples
  45. If we have a rollup job named `sensor`, it can be deleted with:
  46. [source,js]
  47. --------------------------------------------------
  48. DELETE _xpack/rollup/job/sensor
  49. --------------------------------------------------
  50. // CONSOLE
  51. // TEST[setup:sensor_rollup_job]
  52. Which will return the response:
  53. [source,js]
  54. ----
  55. {
  56. "acknowledged": true
  57. }
  58. ----
  59. // TESTRESPONSE
  60. If however we try to delete a job which doesn't exist:
  61. [source,js]
  62. --------------------------------------------------
  63. DELETE _xpack/rollup/job/does_not_exist
  64. --------------------------------------------------
  65. // CONSOLE
  66. // TEST[catch:missing]
  67. A 404 `resource_not_found` exception will be thrown:
  68. [source,js]
  69. ----
  70. {
  71. "error" : {
  72. "root_cause" : [
  73. {
  74. "type" : "resource_not_found_exception",
  75. "reason" : "the task with id does_not_exist doesn't exist",
  76. "stack_trace": ...
  77. }
  78. ],
  79. "type" : "resource_not_found_exception",
  80. "reason" : "the task with id does_not_exist doesn't exist",
  81. "stack_trace": ...
  82. },
  83. "status": 404
  84. }
  85. ----
  86. // TESTRESPONSE[s/"stack_trace": .../"stack_trace": $body.$_path/]