revert-snapshot.asciidoc 3.5 KB

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