revert-snapshot.asciidoc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-revert-snapshot]]
  4. === Revert model snapshots API
  5. ++++
  6. <titleabbrev>Revert model snapshots</titleabbrev>
  7. ++++
  8. Reverts to a specific snapshot.
  9. [[ml-revert-snapshot-request]]
  10. ==== {api-request-title}
  11. `POST _ml/anomaly_detectors/<job_id>/model_snapshots/<snapshot_id>/_revert`
  12. [[ml-revert-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-revert-snapshot-desc]]
  18. ==== {api-description-title}
  19. The {ml} feature in {xpack} reacts quickly to anomalous input, learning new
  20. behaviors in data. Highly anomalous input increases the variance in the models
  21. whilst the system learns whether this is a new step-change in behavior or a
  22. one-off event. In the case where this anomalous input is known to be a one-off,
  23. then it might be appropriate to reset the model state to a time before this
  24. event. For example, you might consider reverting to a saved snapshot after Black
  25. Friday or a critical system failure.
  26. IMPORTANT: Before you revert to a saved snapshot, you must close the job.
  27. [[ml-revert-snapshot-path-parms]]
  28. ==== {api-path-parms-title}
  29. `<job_id>` (Required)::
  30. (string) Identifier for the job.
  31. `<snapshot_id>` (Required)::
  32. (string) Identifier for the model snapshot.
  33. [[ml-revert-snapshot-request-body]]
  34. ==== {api-request-body-title}
  35. `delete_intervening_results` (Optional)::
  36. (boolean) If true, deletes the results in the time period between the
  37. latest results and the time of the reverted snapshot. It also resets the
  38. model to accept records for this time period. The default value is false.
  39. NOTE: If you choose not to delete intervening results when reverting a snapshot,
  40. the job will not accept input data that is older than the current time.
  41. If you want to resend data, then delete the intervening results.
  42. [[ml-revert-snapshot-example]]
  43. ==== {api-examples-title}
  44. The following example reverts to the `1491856080` snapshot for the
  45. `it_ops_new_kpi` job:
  46. [source,js]
  47. --------------------------------------------------
  48. POST
  49. _ml/anomaly_detectors/it_ops_new_kpi/model_snapshots/1491856080/_revert
  50. {
  51. "delete_intervening_results": true
  52. }
  53. --------------------------------------------------
  54. // CONSOLE
  55. // TEST[skip:todo]
  56. When the operation is complete, you receive the following results:
  57. [source,js]
  58. ----
  59. {
  60. "model": {
  61. "job_id": "it_ops_new_kpi",
  62. "min_version": "6.3.0",
  63. "timestamp": 1491856080000,
  64. "description": "State persisted due to job close at 2017-04-10T13:28:00-0700",
  65. "snapshot_id": "1491856080",
  66. "snapshot_doc_count": 1,
  67. "model_size_stats": {
  68. "job_id": "it_ops_new_kpi",
  69. "result_type": "model_size_stats",
  70. "model_bytes": 29518,
  71. "total_by_field_count": 3,
  72. "total_over_field_count": 0,
  73. "total_partition_field_count": 2,
  74. "bucket_allocation_failures_count": 0,
  75. "memory_status": "ok",
  76. "log_time": 1491856080000,
  77. "timestamp": 1455318000000
  78. },
  79. "latest_record_time_stamp": 1455318669000,
  80. "latest_result_time_stamp": 1455318000000,
  81. "retain": false
  82. }
  83. }
  84. ----