2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
2018-08-31 19:49:24 -04:00
|
|
|
[testenv="platinum"]
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-get-snapshot]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Get model snapshots API
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2018-12-20 13:23:28 -05:00
|
|
|
<titleabbrev>Get model snapshots</titleabbrev>
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
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
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-snapshot-request]]
|
|
|
|
==== {api-request-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`GET _ml/anomaly_detectors/<job_id>/model_snapshots` +
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`GET _ml/anomaly_detectors/<job_id>/model_snapshots/<snapshot_id>`
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
[[ml-get-snapshot-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* If the {es} {security-features} are enabled, you must have `monitor_ml`,
|
|
|
|
`monitor`, `manage_ml`, or `manage` cluster privileges to use this API. See
|
|
|
|
{stack-ov}/security-privileges.html[Security privileges].
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-snapshot-path-parms]]
|
|
|
|
==== {api-path-parms-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
`<job_id>` (Required)::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Identifier for the job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
`<snapshot_id>` (Optional)::
|
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
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-snapshot-request-body]]
|
|
|
|
==== {api-request-body-title}
|
2017-04-11 16:25:38 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
`desc` (Optional)::
|
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
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
`end` (Optional)::
|
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
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
`from` (Optional)::
|
2017-04-11 22:26:18 -04:00
|
|
|
(integer) Skips the specified number of snapshots.
|
2017-04-11 16:25:38 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
`size` (Optional)::
|
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
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
`sort` (Optional)::
|
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
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
`start` (Optional)::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Returns snapshots with timestamps after this time.
|
2017-04-11 16:25:38 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-snapshot-results]]
|
|
|
|
==== {api-response-body-title}
|
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
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-snapshot-example]]
|
|
|
|
==== {api-examples-title}
|
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]
|
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
GET _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
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|