2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-get-record]]
|
2017-06-06 16:42:47 -04:00
|
|
|
=== Get Records
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
The get records API enables you to retrieve anomaly records for a job.
|
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>/results/records`
|
|
|
|
|
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
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Request Body
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
`desc`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(boolean) If true, the results are sorted in descending order.
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
`end`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Returns records with timestamps earlier than this time.
|
2017-04-10 19:14:26 -04:00
|
|
|
|
2017-04-24 13:46:17 -04:00
|
|
|
`exclude_interim`::
|
|
|
|
(boolean) If true, the output excludes interim results.
|
|
|
|
By default, interim results are included.
|
|
|
|
|
2017-05-08 09:53:04 -04:00
|
|
|
`page`::
|
|
|
|
`from`:::
|
2017-04-11 22:26:18 -04:00
|
|
|
(integer) Skips the specified number of records.
|
2017-05-08 09:53:04 -04:00
|
|
|
`size`:::
|
|
|
|
(integer) Specifies the maximum number of records to obtain.
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
`record_score`::
|
2017-12-08 11:03:51 -05:00
|
|
|
(double) Returns records with anomaly scores greater or equal than this value.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
`sort`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Specifies the sort field for the requested records.
|
2017-04-10 19:14:26 -04:00
|
|
|
By default, the records are sorted by the `anomaly_score` value.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
`start`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Returns records with timestamps after this time.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Results
|
2017-04-10 19:14:26 -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
|
|
|
`records`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(array) An array of record objects. For more information, see
|
2017-04-11 16:25:38 -04:00
|
|
|
<<ml-results-records,Records>>.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -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
|
|
|
|
privileges to use this API. You also need `read` index privilege on the index
|
|
|
|
that stores the results. The `machine_learning_admin` and `machine_learning_user`
|
|
|
|
roles provide these privileges. For more information, see
|
2017-06-19 21:23:58 -04:00
|
|
|
{xpack-ref}/security-privileges.html[Security Privileges] and
|
|
|
|
{xpack-ref}/built-in-roles.html[Built-in Roles].
|
|
|
|
//<<security-privileges>> and <<built-in-roles>>.
|
2017-04-25 17:08:29 -04:00
|
|
|
|
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Examples
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-05-08 09:53:04 -04:00
|
|
|
The following example gets record information for the `it-ops-kpi` job:
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2017-04-11 21:52:47 -04:00
|
|
|
GET _xpack/ml/anomaly_detectors/it-ops-kpi/results/records
|
2017-04-10 19:14:26 -04:00
|
|
|
{
|
|
|
|
"sort": "record_score",
|
|
|
|
"desc": true,
|
2017-04-11 21:52:47 -04:00
|
|
|
"start": "1454944100000"
|
2017-04-10 19:14:26 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
In this example, the API returns twelve results for the specified
|
|
|
|
time constraints:
|
2017-04-21 11:23:27 -04:00
|
|
|
[source,js]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
2017-04-11 21:52:47 -04:00
|
|
|
"count": 12,
|
2017-04-10 19:14:26 -04:00
|
|
|
"records": [
|
|
|
|
{
|
2017-04-11 21:52:47 -04:00
|
|
|
"job_id": "it-ops-kpi",
|
2017-04-10 19:14:26 -04:00
|
|
|
"result_type": "record",
|
2017-04-11 21:52:47 -04:00
|
|
|
"probability": 0.00000332668,
|
|
|
|
"record_score": 72.9929,
|
|
|
|
"initial_record_score": 65.7923,
|
|
|
|
"bucket_span": 300,
|
2017-04-10 19:14:26 -04:00
|
|
|
"detector_index": 0,
|
|
|
|
"is_interim": false,
|
|
|
|
"timestamp": 1454944200000,
|
2017-04-11 21:52:47 -04:00
|
|
|
"function": "low_sum",
|
|
|
|
"function_description": "sum",
|
2017-04-10 19:14:26 -04:00
|
|
|
"typical": [
|
2017-04-11 21:52:47 -04:00
|
|
|
1806.48
|
2017-04-10 19:14:26 -04:00
|
|
|
],
|
|
|
|
"actual": [
|
2017-04-11 21:52:47 -04:00
|
|
|
288
|
2017-04-10 19:14:26 -04:00
|
|
|
],
|
2017-04-11 21:52:47 -04:00
|
|
|
"field_name": "events_per_min"
|
2017-04-10 19:14:26 -04:00
|
|
|
},
|
|
|
|
...
|
2017-04-04 18:26:39 -04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|