update-snapshot.asciidoc 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 {anomaly-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 {anomaly-job} is
  33. deleted. 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,console]
  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. // TEST[skip:todo]
  47. When the snapshot is updated, you receive the following results:
  48. [source,js]
  49. ----
  50. {
  51. "acknowledged": true,
  52. "model": {
  53. "job_id": "it_ops_new_logs",
  54. "timestamp": 1491852978000,
  55. "description": "Snapshot 1",
  56. ...
  57. "retain": true
  58. }
  59. }
  60. ----