2017-04-11 21:52:47 -04:00
|
|
|
//lcawley Verified example output 2017-04-11
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-get-snapshot]]
|
|
|
|
==== Get Model Snapshots
|
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
The get model snapshots API enables you to retrieve information about model snapshots.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Request
|
|
|
|
|
|
|
|
`GET _xpack/ml/anomaly_detectors/<job_id>/model_snapshots` +
|
|
|
|
|
|
|
|
`GET _xpack/ml/anomaly_detectors/<job_id>/model_snapshots/<snapshot_id>`
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
//===== Description
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Path Parameters
|
|
|
|
|
|
|
|
`job_id`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Identifier for the job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`snapshot_id`::
|
2017-04-18 18:13:21 -04:00
|
|
|
(string) Identifier for the model snapshot. If you do not specify this
|
|
|
|
optional parameter, the API returns information about all model snapshots.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 16:25:38 -04:00
|
|
|
===== Request Body
|
|
|
|
|
|
|
|
`desc`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(boolean) If true, the results are sorted in descending order.
|
2017-04-11 16:25:38 -04:00
|
|
|
|
|
|
|
`description`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Returns snapshots that match this description.
|
2017-04-11 16:25:38 -04:00
|
|
|
//TBD: I couldn't get this to work. What description value is it using?
|
|
|
|
NOTE: It might be necessary to URL encode the description.
|
|
|
|
|
|
|
|
`end`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(date) Returns snapshots with timestamps earlier than this time.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 16:25:38 -04:00
|
|
|
`from`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(integer) Skips the specified number of snapshots.
|
2017-04-11 16:25:38 -04:00
|
|
|
|
|
|
|
`size`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(integer) Specifies the maximum number of snapshots to obtain.
|
2017-04-11 16:25:38 -04:00
|
|
|
|
|
|
|
`sort`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Specifies the sort field for the requested snapshots.
|
2017-04-11 16:25:38 -04:00
|
|
|
//By default, the snapshots are sorted by the xxx value.
|
|
|
|
|
|
|
|
`start`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Returns snapshots with timestamps after this time.
|
2017-04-11 16:25:38 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-04-11 16:25:38 -04:00
|
|
|
===== Results
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 16:25:38 -04:00
|
|
|
The API returns the following information:
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 16:25:38 -04:00
|
|
|
`model_snapshots`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(array) An array of model snapshot objects. For more information, see
|
2017-04-11 16:25:38 -04:00
|
|
|
<<ml-snapshot-resource,Model Snapshots>>.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
===== Authorization
|
|
|
|
|
|
|
|
You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
|
|
|
|
privileges to use this API. For more information, see <<privileges-list-cluster>>.
|
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
===== Examples
|
|
|
|
|
2017-04-11 16:25:38 -04:00
|
|
|
The following example gets model snapshot information for the
|
|
|
|
`it_ops_new_logs` job:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2017-04-11 21:52:47 -04:00
|
|
|
GET _xpack/ml/anomaly_detectors/farequote/model_snapshots
|
2017-04-11 16:25:38 -04:00
|
|
|
{
|
|
|
|
"start": "1491852977000"
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
|
|
|
In this example, the API provides a single result:
|
2017-04-21 11:23:27 -04:00
|
|
|
[source,js]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
|
|
|
"count": 1,
|
2017-04-11 16:25:38 -04:00
|
|
|
"model_snapshots": [
|
|
|
|
{
|
2017-04-11 21:52:47 -04:00
|
|
|
"job_id": "farequote",
|
|
|
|
"timestamp": 1491948163000,
|
|
|
|
"description": "State persisted due to job close at 2017-04-11T15:02:43-0700",
|
|
|
|
"snapshot_id": "1491948163",
|
2017-04-11 16:25:38 -04:00
|
|
|
"snapshot_doc_count": 1,
|
|
|
|
"model_size_stats": {
|
2017-04-11 21:52:47 -04:00
|
|
|
"job_id": "farequote",
|
2017-04-11 16:25:38 -04:00
|
|
|
"result_type": "model_size_stats",
|
2017-04-11 21:52:47 -04:00
|
|
|
"model_bytes": 387594,
|
|
|
|
"total_by_field_count": 21,
|
2017-04-11 16:25:38 -04:00
|
|
|
"total_over_field_count": 0,
|
2017-04-11 21:52:47 -04:00
|
|
|
"total_partition_field_count": 20,
|
2017-04-11 16:25:38 -04:00
|
|
|
"bucket_allocation_failures_count": 0,
|
|
|
|
"memory_status": "ok",
|
2017-04-11 21:52:47 -04:00
|
|
|
"log_time": 1491948163000,
|
|
|
|
"timestamp": 1455234600000
|
2017-04-04 18:26:39 -04:00
|
|
|
},
|
2017-04-11 21:52:47 -04:00
|
|
|
"latest_record_time_stamp": 1455235196000,
|
|
|
|
"latest_result_time_stamp": 1455234900000,
|
2017-04-11 16:25:38 -04:00
|
|
|
"retain": false
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|