revert-snapshot.asciidoc 3.8 KB

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