revert-snapshot.asciidoc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. * Before you revert to a saved snapshot, you must close the job.
  15. * Requires the `manage_ml` cluster privilege. This privilege is included in the
  16. `machine_learning_admin` built-in role.
  17. [[ml-revert-snapshot-desc]]
  18. == {api-description-title}
  19. The {ml-features} react 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. NOTE: Reverting to a snapshot does not change the `data_counts` values of the
  27. {anomaly-job}, these values are not reverted to the earlier state.
  28. [[ml-revert-snapshot-path-parms]]
  29. == {api-path-parms-title}
  30. `<job_id>`::
  31. (Required, string)
  32. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  33. `<snapshot_id>`::
  34. (Required, string)
  35. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=snapshot-id]
  36. +
  37. --
  38. You can specify `empty` as the <snapshot_id>. Reverting to the `empty` snapshot
  39. means the {anomaly-job} starts learning a new model from scratch when it is
  40. started.
  41. --
  42. [[ml-revert-snapshot-request-body]]
  43. == {api-request-body-title}
  44. `delete_intervening_results`::
  45. (Optional, Boolean) If true, deletes the results in the time period between
  46. the latest results and the time of the reverted snapshot. It also resets the
  47. model to accept records for this time period. The default value is false.
  48. NOTE: If you choose not to delete intervening results when reverting a snapshot,
  49. the job will not accept input data that is older than the current time.
  50. If you want to resend data, then delete the intervening results.
  51. [[ml-revert-snapshot-example]]
  52. == {api-examples-title}
  53. [source,console]
  54. --------------------------------------------------
  55. POST _ml/anomaly_detectors/high_sum_total_sales/model_snapshots/1575402237/_revert
  56. {
  57. "delete_intervening_results": true
  58. }
  59. --------------------------------------------------
  60. // TEST[skip:todo]
  61. When the operation is complete, you receive the following results:
  62. [source,js]
  63. ----
  64. {
  65. "model" : {
  66. "job_id" : "high_sum_total_sales",
  67. "min_version" : "6.4.0",
  68. "timestamp" : 1575402237000,
  69. "description" : "State persisted due to job close at 2019-12-03T19:43:57+0000",
  70. "snapshot_id" : "1575402237",
  71. "snapshot_doc_count" : 1,
  72. "model_size_stats" : {
  73. "job_id" : "high_sum_total_sales",
  74. "result_type" : "model_size_stats",
  75. "model_bytes" : 1638816,
  76. "model_bytes_exceeded" : 0,
  77. "model_bytes_memory_limit" : 10485760,
  78. "total_by_field_count" : 3,
  79. "total_over_field_count" : 3320,
  80. "total_partition_field_count" : 2,
  81. "bucket_allocation_failures_count" : 0,
  82. "memory_status" : "ok",
  83. "categorized_doc_count" : 0,
  84. "total_category_count" : 0,
  85. "frequent_category_count" : 0,
  86. "rare_category_count" : 0,
  87. "dead_category_count" : 0,
  88. "failed_category_count" : 0,
  89. "categorization_status" : "ok",
  90. "log_time" : 1575402237000,
  91. "timestamp" : 1576965600000
  92. },
  93. "latest_record_time_stamp" : 1576971072000,
  94. "latest_result_time_stamp" : 1576965600000,
  95. "retain" : false
  96. }
  97. }
  98. ----
  99. For a description of these properties, see the
  100. <<ml-get-snapshot-results,get model snapshots API>>.