delete-job.asciidoc 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[rollup-delete-job]]
  4. === Delete {rollup-jobs} API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Delete {rollup-jobs}</titleabbrev>
  8. ++++
  9. Deletes an existing {rollup-job}.
  10. experimental[]
  11. [[rollup-delete-job-request]]
  12. ==== {api-request-title}
  13. `DELETE _rollup/job/<job_id>`
  14. [[rollup-delete-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-delete-job-desc]]
  20. ==== {api-description-title}
  21. A job must be *stopped* first before it can be deleted. If you attempt to delete
  22. a started job, an error occurs. Similarly, if you attempt to delete a
  23. nonexistent job, an exception occurs.
  24. [IMPORTANT]
  25. ===============================
  26. When a job is deleted, that only removes the process that is actively monitoring
  27. and rolling up data. It does not delete any previously rolled up data. This is
  28. by design; a user may wish to roll up a static dataset. Because the dataset is
  29. static, once it has been fully rolled up there is no need to keep the indexing
  30. rollup job around (as there will be no new data). So the job can be deleted,
  31. leaving behind the rolled up data for analysis.
  32. If you wish to also remove the rollup data, and the rollup index only contains
  33. the data for a single job, you can simply delete the whole rollup index. If the
  34. rollup index stores data from several jobs, you must issue a delete-by-query
  35. that targets the rollup job's ID in the rollup index.
  36. [source,js]
  37. --------------------------------------------------
  38. POST my_rollup_index/_delete_by_query
  39. {
  40. "query": {
  41. "term": {
  42. "_rollup.id": "the_rollup_job_id"
  43. }
  44. }
  45. }
  46. --------------------------------------------------
  47. // NOTCONSOLE
  48. ===============================
  49. [[rollup-delete-job-path-params]]
  50. ==== {api-path-parms-title}
  51. `<job_id>`::
  52. (Required, string) Identifier for the job.
  53. [[rollup-delete-job-response-codes]]
  54. ==== {api-response-codes-title}
  55. `404` (Missing resources)::
  56. This code indicates that there are no resources that match the request. It
  57. occurs if you try to delete a job that doesn't exist.
  58. [[rollup-delete-job-example]]
  59. ==== {api-example-title}
  60. If we have a rollup job named `sensor`, it can be deleted with:
  61. [source,console]
  62. --------------------------------------------------
  63. DELETE _rollup/job/sensor
  64. --------------------------------------------------
  65. // TEST[setup:sensor_rollup_job]
  66. Which will return the response:
  67. [source,console-result]
  68. ----
  69. {
  70. "acknowledged": true
  71. }
  72. ----