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-desc]]
  13. ==== {api-description-title}
  14. The {ml} feature in {xpack} reacts quickly to anomalous input, learning new
  15. behaviors in data. Highly anomalous input increases the variance in the models
  16. whilst the system learns whether this is a new step-change in behavior or a
  17. one-off event. In the case where this anomalous input is known to be a one-off,
  18. then it might be appropriate to reset the model state to a time before this
  19. event. For example, you might consider reverting to a saved snapshot after Black
  20. Friday or a critical system failure.
  21. IMPORTANT: Before you revert to a saved snapshot, you must close the job.
  22. [[ml-revert-snapshot-path-parms]]
  23. ==== {api-path-parms-title}
  24. `job_id` (required)::
  25. (string) Identifier for the job
  26. `snapshot_id` (required)::
  27. (string) Identifier for the model snapshot
  28. [[ml-revert-snapshot-request-body]]
  29. ==== {api-request-body-title}
  30. `delete_intervening_results`::
  31. (boolean) If true, deletes the results in the time period between the
  32. latest results and the time of the reverted snapshot. It also resets the
  33. model to accept records for this time period. The default value is false.
  34. NOTE: If you choose not to delete intervening results when reverting a snapshot,
  35. the job will not accept input data that is older than the current time.
  36. If you want to resend data, then delete the intervening results.
  37. [[ml-revert-snapshot-prereqs]]
  38. ==== {api-prereq-title}
  39. You must have `manage_ml`, or `manage` cluster privileges to use this API.
  40. For more information, see
  41. {stack-ov}/security-privileges.html[Security privileges].
  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. ----