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-bucket]]
|
|
|
|
==== Get Buckets
|
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
The get bucket API enables you to retrieve information about buckets in the
|
2017-04-10 19:14:26 -04:00
|
|
|
results from a job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
===== Request
|
|
|
|
|
|
|
|
`GET _xpack/ml/anomaly_detectors/<job_id>/results/buckets` +
|
|
|
|
|
|
|
|
`GET _xpack/ml/anomaly_detectors/<job_id>/results/buckets/<timestamp>`
|
2017-04-10 19:14:26 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Description
|
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
This API presents a chronological view of the records, grouped by bucket.
|
|
|
|
|
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
|
|
|
|
|
|
|
`timestamp`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) The timestamp of a single bucket result.
|
2017-04-10 19:14:26 -04:00
|
|
|
If you do not specify this optional parameter, the API returns information
|
|
|
|
about all buckets that you have authority to view in the job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
===== Request Body
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
`anomaly_score`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(double) Returns buckets with anomaly scores higher than this value.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
`end`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Returns buckets with timestamps earlier than this time.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
`expand`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(boolean) If true, the output includes anomaly records.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
`from`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(integer) Skips the specified number of buckets.
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
`include_interim`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(boolean) If true, the output includes interim results.
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
`partition_value`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) If `expand` is true, the anomaly records are filtered by this
|
2017-04-10 19:14:26 -04:00
|
|
|
partition value.
|
|
|
|
|
|
|
|
`size`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(integer) Specifies the maximum number of buckets to obtain.
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
`start`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Returns buckets with timestamps after this time.
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
===== Results
|
|
|
|
|
|
|
|
The API returns the following information:
|
|
|
|
|
|
|
|
`buckets`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(array) An array of bucket objects. For more information, see
|
2017-04-10 19:14:26 -04:00
|
|
|
<<ml-results-buckets,Buckets>>.
|
|
|
|
|
|
|
|
////
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Responses
|
|
|
|
|
|
|
|
200
|
|
|
|
(EmptyResponse) The cluster has been successfully deleted
|
|
|
|
404
|
|
|
|
(BasicFailedReply) The cluster specified by {cluster_id} cannot be found (code: clusters.cluster_not_found)
|
|
|
|
412
|
|
|
|
(BasicFailedReply) The Elasticsearch cluster has not been shutdown yet (code: clusters.cluster_plan_state_error)
|
2017-04-10 19:14:26 -04:00
|
|
|
////
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Examples
|
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
The following example gets bucket information for the `it-ops-kpi` job:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
GET _xpack/ml/anomaly_detectors/it-ops-kpi/results/buckets
|
|
|
|
{
|
|
|
|
"anomaly_score": 80,
|
|
|
|
"start": "1454530200001"
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
|
|
|
In this example, the API returns a single result that matches the specified
|
|
|
|
score and time constraints:
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
|
|
|
"count": 1,
|
2017-04-10 19:14:26 -04:00
|
|
|
"buckets": [
|
|
|
|
{
|
2017-04-04 18:26:39 -04:00
|
|
|
"job_id": "it-ops-kpi",
|
2017-04-10 19:14:26 -04:00
|
|
|
"timestamp": 1454943900000,
|
2017-04-11 21:52:47 -04:00
|
|
|
"anomaly_score": 94.1706,
|
2017-04-10 19:14:26 -04:00
|
|
|
"bucket_span": 300,
|
2017-04-11 21:52:47 -04:00
|
|
|
"initial_anomaly_score": 94.1706,
|
2017-04-10 19:14:26 -04:00
|
|
|
"record_count": 1,
|
|
|
|
"event_count": 153,
|
|
|
|
"is_interim": false,
|
|
|
|
"bucket_influencers": [
|
|
|
|
{
|
|
|
|
"job_id": "it-ops-kpi",
|
|
|
|
"result_type": "bucket_influencer",
|
|
|
|
"influencer_field_name": "bucket_time",
|
2017-04-11 21:52:47 -04:00
|
|
|
"initial_anomaly_score": 94.1706,
|
|
|
|
"anomaly_score": 94.1706,
|
|
|
|
"raw_anomaly_score": 2.32119,
|
|
|
|
"probability": 0.00000575042,
|
2017-04-10 19:14:26 -04:00
|
|
|
"timestamp": 1454943900000,
|
|
|
|
"bucket_span": 300,
|
|
|
|
"sequence_num": 2,
|
|
|
|
"is_interim": false
|
|
|
|
}
|
|
|
|
],
|
2017-04-11 21:52:47 -04:00
|
|
|
"processing_time_ms": 2,
|
2017-04-10 19:14:26 -04:00
|
|
|
"partition_scores": [],
|
|
|
|
"result_type": "bucket"
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|