revert-snapshot.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. ==== Request
  10. `POST _xpack/ml/anomaly_detectors/<job_id>/model_snapshots/<snapshot_id>/_revert`
  11. ==== Description
  12. The {ml} feature in {xpack} reacts quickly to anomalous input, learning new
  13. behaviors in data. Highly anomalous input increases the variance in the models
  14. whilst the system learns whether this is a new step-change in behavior or a
  15. one-off event. In the case where this anomalous input is known to be a one-off,
  16. then it might be appropriate to reset the model state to a time before this
  17. event. For example, you might consider reverting to a saved snapshot after Black
  18. Friday or a critical system failure.
  19. IMPORTANT: Before you revert to a saved snapshot, you must close the job.
  20. ==== Path Parameters
  21. `job_id` (required)::
  22. (string) Identifier for the job
  23. `snapshot_id` (required)::
  24. (string) Identifier for the model snapshot
  25. ==== Request Body
  26. `delete_intervening_results`::
  27. (boolean) If true, deletes the results in the time period between the
  28. latest results and the time of the reverted snapshot. It also resets the
  29. model to accept records for this time period. The default value is false.
  30. NOTE: If you choose not to delete intervening results when reverting a snapshot,
  31. the job will not accept input data that is older than the current time.
  32. If you want to resend data, then delete the intervening results.
  33. ==== Authorization
  34. You must have `manage_ml`, or `manage` cluster privileges to use this API.
  35. For more information, see
  36. {xpack-ref}/security-privileges.html[Security Privileges].
  37. ==== Examples
  38. The following example reverts to the `1491856080` snapshot for the
  39. `it_ops_new_kpi` job:
  40. [source,js]
  41. --------------------------------------------------
  42. POST
  43. _xpack/ml/anomaly_detectors/it_ops_new_kpi/model_snapshots/1491856080/_revert
  44. {
  45. "delete_intervening_results": true
  46. }
  47. --------------------------------------------------
  48. // CONSOLE
  49. // TEST[skip:todo]
  50. When the operation is complete, you receive the following results:
  51. [source,js]
  52. ----
  53. {
  54. "model": {
  55. "job_id": "it_ops_new_kpi",
  56. "min_version": "6.3.0",
  57. "timestamp": 1491856080000,
  58. "description": "State persisted due to job close at 2017-04-10T13:28:00-0700",
  59. "snapshot_id": "1491856080",
  60. "snapshot_doc_count": 1,
  61. "model_size_stats": {
  62. "job_id": "it_ops_new_kpi",
  63. "result_type": "model_size_stats",
  64. "model_bytes": 29518,
  65. "total_by_field_count": 3,
  66. "total_over_field_count": 0,
  67. "total_partition_field_count": 2,
  68. "bucket_allocation_failures_count": 0,
  69. "memory_status": "ok",
  70. "log_time": 1491856080000,
  71. "timestamp": 1455318000000
  72. },
  73. "latest_record_time_stamp": 1455318669000,
  74. "latest_result_time_stamp": 1455318000000,
  75. "retain": false
  76. }
  77. }
  78. ----