Update model snapshots API

Update model snapshots API

New API reference

For the most up-to-date API details, refer to Machine learning anomaly detection APIs.

Updates certain properties of a snapshot.

Request

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

Prerequisites

Requires the manage_ml cluster privilege. This privilege is included in the machine_learning_admin built-in role.

Path parameters

<job_id>

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

<snapshot_id>

(Required, string) Identifier for the model snapshot.

Request body

The following properties can be updated after the model snapshot is created:

description

(Optional, string) A description of the model snapshot.

retain

(Optional, Boolean) If true, this snapshot will not be deleted during automatic cleanup of snapshots older than model_snapshot_retention_days. However, this snapshot will be deleted when the job is deleted. The default value is false.

Examples

  1. resp = client.ml.update_model_snapshot(
  2. job_id="it_ops_new_logs",
  3. snapshot_id="1491852978",
  4. description="Snapshot 1",
  5. retain=True,
  6. )
  7. print(resp)
  1. response = client.ml.update_model_snapshot(
  2. job_id: 'it_ops_new_logs',
  3. snapshot_id: 1_491_852_978,
  4. body: {
  5. description: 'Snapshot 1',
  6. retain: true
  7. }
  8. )
  9. puts response
  1. const response = await client.ml.updateModelSnapshot({
  2. job_id: "it_ops_new_logs",
  3. snapshot_id: 1491852978,
  4. description: "Snapshot 1",
  5. retain: true,
  6. });
  7. console.log(response);
  1. POST
  2. _ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update
  3. {
  4. "description": "Snapshot 1",
  5. "retain": true
  6. }

When the snapshot is updated, you receive the following results:

  1. {
  2. "acknowledged": true,
  3. "model": {
  4. "job_id": "it_ops_new_logs",
  5. "timestamp": 1491852978000,
  6. "description": "Snapshot 1",
  7. ...
  8. "retain": true
  9. }
  10. }