delete-job.asciidoc 2.7 KB

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