update-snapshot.asciidoc 1.7 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. <<security-privileges>>.
  17. [[ml-update-snapshot-path-parms]]
  18. ==== {api-path-parms-title}
  19. `<job_id>`::
  20. (Required, string)
  21. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  22. `<snapshot_id>`::
  23. (Required, string)
  24. include::{docdir}/ml/ml-shared.asciidoc[tag=snapshot-id]
  25. [[ml-update-snapshot-request-body]]
  26. ==== {api-request-body-title}
  27. The following properties can be updated after the model snapshot is created:
  28. `description`::
  29. (Optional, string) A description of the model snapshot.
  30. `retain`::
  31. (Optional, boolean)
  32. include::{docdir}/ml/ml-shared.asciidoc[tag=retain]
  33. [[ml-update-snapshot-example]]
  34. ==== {api-examples-title}
  35. The following example updates the snapshot identified as `1491852978`:
  36. [source,console]
  37. --------------------------------------------------
  38. POST
  39. _ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update
  40. {
  41. "description": "Snapshot 1",
  42. "retain": true
  43. }
  44. --------------------------------------------------
  45. // TEST[skip:todo]
  46. When the snapshot is updated, you receive the following results:
  47. [source,js]
  48. ----
  49. {
  50. "acknowledged": true,
  51. "model": {
  52. "job_id": "it_ops_new_logs",
  53. "timestamp": 1491852978000,
  54. "description": "Snapshot 1",
  55. ...
  56. "retain": true
  57. }
  58. }
  59. ----