Revert model snapshots API

Reverts to a specific snapshot.

Request

POST _ml/anomaly_detectors/<job_id>/model_snapshots/<snapshot_id>/_revert

Prerequisites

Description

The machine learning features reacts quickly to anomalous input, learning new behaviors in data. Highly anomalous input increases the variance in the models whilst the system learns whether this is a new step-change in behavior or a one-off event. In the case where this anomalous input is known to be a one-off, then it might be appropriate to reset the model state to a time before this event. For example, you might consider reverting to a saved snapshot after Black Friday or a critical system failure.

Path parameters

<job_id>

(Required, string) Identifier for the anomaly detection job.

<snapshot_id>

(Required, string) A numerical character string that uniquely identifies the model snapshot.

Request body

delete_intervening_results

(Optional, boolean) If true, deletes the results in the time period between the latest results and the time of the reverted snapshot. It also resets the model to accept records for this time period. The default value is false.

If you choose not to delete intervening results when reverting a snapshot, the job will not accept input data that is older than the current time. If you want to resend data, then delete the intervening results.

Examples

  1. POST _ml/anomaly_detectors/high_sum_total_sales/model_snapshots/1575402237/_revert
  2. {
  3. "delete_intervening_results": true
  4. }

When the operation is complete, you receive the following results:

  1. {
  2. "model" : {
  3. "job_id" : "high_sum_total_sales",
  4. "min_version" : "6.4.0",
  5. "timestamp" : 1575402237000,
  6. "description" : "State persisted due to job close at 2019-12-03T19:43:57+0000",
  7. "snapshot_id" : "1575402237",
  8. "snapshot_doc_count" : 1,
  9. "model_size_stats" : {
  10. "job_id" : "high_sum_total_sales",
  11. "result_type" : "model_size_stats",
  12. "model_bytes" : 1638816,
  13. "model_bytes_exceeded" : 0,
  14. "model_bytes_memory_limit" : 10485760,
  15. "total_by_field_count" : 3,
  16. "total_over_field_count" : 3320,
  17. "total_partition_field_count" : 2,
  18. "bucket_allocation_failures_count" : 0,
  19. "memory_status" : "ok",
  20. "categorized_doc_count" : 0,
  21. "total_category_count" : 0,
  22. "frequent_category_count" : 0,
  23. "rare_category_count" : 0,
  24. "dead_category_count" : 0,
  25. "failed_category_count" : 0,
  26. "categorization_status" : "ok",
  27. "log_time" : 1575402237000,
  28. "timestamp" : 1576965600000
  29. },
  30. "latest_record_time_stamp" : 1576971072000,
  31. "latest_result_time_stamp" : 1576965600000,
  32. "retain" : false
  33. }
  34. }

For a description of these properties, see the get model snapshots API.