update-snapshot.asciidoc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-update-snapshot]]
  4. === Update model snapshots API
  5. ++++
  6. <titleabbrev>Update model snapshots</titleabbrev>
  7. ++++
  8. Updates certain properties of a snapshot.
  9. [[ml-update-snapshot-request]]
  10. ==== {api-request-title}
  11. `POST _ml/anomaly_detectors/<job_id>/model_snapshots/<snapshot_id>/_update`
  12. [[ml-update-snapshot-prereqs]]
  13. ==== {api-prereq-title}
  14. * If the {es} {security-features} are enabled, you must have `manage_ml` or
  15. `manage` cluster privileges to use this API. See
  16. {stack-ov}/security-privileges.html[Security privileges].
  17. [[ml-update-snapshot-path-parms]]
  18. ==== {api-path-parms-title}
  19. `<job_id>`::
  20. (Required, string) Identifier for the job.
  21. `<snapshot_id>`::
  22. (Required, string) Identifier for the model snapshot.
  23. [[ml-update-snapshot-request-body]]
  24. ==== {api-request-body-title}
  25. The following properties can be updated after the model snapshot is created:
  26. `description`::
  27. (Optional, string) A description of the model snapshot. For example,
  28. "Before black friday".
  29. `retain`::
  30. (Optional, boolean) If true, this snapshot will not be deleted during
  31. automatic cleanup of snapshots older than `model_snapshot_retention_days`.
  32. Note that this snapshot will still be deleted when the job is deleted.
  33. The default value is false.
  34. [[ml-update-snapshot-example]]
  35. ==== {api-examples-title}
  36. The following example updates the snapshot identified as `1491852978`:
  37. [source,js]
  38. --------------------------------------------------
  39. POST
  40. _ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update
  41. {
  42. "description": "Snapshot 1",
  43. "retain": true
  44. }
  45. --------------------------------------------------
  46. // CONSOLE
  47. // TEST[skip:todo]
  48. When the snapshot is updated, you receive the following results:
  49. [source,js]
  50. ----
  51. {
  52. "acknowledged": true,
  53. "model": {
  54. "job_id": "it_ops_new_logs",
  55. "timestamp": 1491852978000,
  56. "description": "Snapshot 1",
  57. ...
  58. "retain": true
  59. }
  60. }
  61. ----