2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-get-snapshot]]
|
2017-12-14 13:52:49 -05:00
|
|
|
=== Get Model Snapshots API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Get Model Snapshots</titleabbrev>
|
|
|
|
++++
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-06-13 16:37:35 -04:00
|
|
|
Retrieves information about model snapshots.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Request
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`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-06-06 16:42:47 -04:00
|
|
|
==== Path Parameters
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`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-06-06 16:42:47 -04:00
|
|
|
==== Request Body
|
2017-04-11 16:25:38 -04:00
|
|
|
|
|
|
|
`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
|
|
|
|
|
|
|
`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-05-03 08:20:52 -04:00
|
|
|
By default, the snapshots are sorted by their timestamp.
|
2017-04-11 16:25:38 -04:00
|
|
|
|
|
|
|
`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-06-06 16:42:47 -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-06-06 16:42:47 -04:00
|
|
|
==== Authorization
|
2017-04-25 17:08:29 -04:00
|
|
|
|
|
|
|
You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
|
2017-06-19 21:23:58 -04:00
|
|
|
privileges to use this API. For more information, see
|
|
|
|
{xpack-ref}/security-privileges.html[Security Privileges].
|
|
|
|
//<<privileges-list-cluster>>.
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Examples
|
2017-04-04 18:26:39 -04:00
|
|
|
|
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",
|
2018-03-15 13:38:52 -04:00
|
|
|
"min_version": "6.3.0",
|
2017-04-11 21:52:47 -04:00
|
|
|
"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
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|