OpenSearch/docs/en/rest-api/ml/get-overall-buckets.asciidoc

127 lines
3.6 KiB
Plaintext
Raw Normal View History

[role="xpack"]
[[ml-get-overall-buckets]]
=== Get Overall Buckets
This API enables you to retrieve overall bucket results
that summarize the bucket results of multiple jobs.
==== Request
`GET _xpack/ml/anomaly_detectors/<job_id>/results/overall_buckets`
==== Description
An overall bucket has a span equal to the largest job's `bucket_span`.
The `overall_score` is calculated by combining the scores of all the
buckets within the overall bucket span. The max `anomaly_score` per
job is calculated. Then the `top_n` of those scores are averaged to
result into the `overall_score`. This means that you can fine-tune
the `overall_score` so that it is more or less sensitive to the number
of jobs that detect an anomaly at the same time.
For example, set `top_n` to 1 and the `overall_score` will be the
max bucket score in the overall bucket interval. To the contrary,
set `top_n` to the number of jobs and the `overall_score` will
only be high when all jobs present anomalies in that overall bucket.
==== Path Parameters
`job_id`::
(string) Identifier for the job. It can be a job identifier, a group name,
or a wildcard expression. If set to `_all`, the API returns overall buckets
for all jobs.
==== Request Body
`top_n`::
(integer) The number of top job bucket scores to be used in the
`overall_score` calculation. The default value is `1`.
`overall_score`::
(double) Returns overall buckets with overall scores higher than this value.
`exclude_interim`::
(boolean) If true, the output excludes interim overall buckets.
Overall buckets are interim if any of the job buckets within
the overall bucket interval is interim.
By default, interim results are included.
`start`::
(string) Returns overall buckets with timestamps after this time.
`end`::
(string) Returns overall buckets with timestamps earlier than this time.
`allow_no_jobs`::
(boolean) If `false` and the `job_id` does not match any job an error will
be returned. The default value is `true`.
===== Results
The API returns the following information:
`overall_buckets`::
(array) An array of overall bucket objects. For more information, see
<<ml-results-overall-buckets,Overall Buckets>>.
==== Authorization
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
{xpack-ref}/security-privileges.html[Security Privileges] and
{xpack-ref}/built-in-roles.html[Built-in Roles].
//<<security-privileges>> and <<built-in-roles>>.
==== Examples
The following example gets overall buckets for jobs with IDs matching `job-*`:
[source,js]
--------------------------------------------------
GET _xpack/ml/anomaly_detectors/job-*/results/overall_buckets
{
"overall_score": 90,
"start": "1403532000000"
}
--------------------------------------------------
// CONSOLE
// TEST[skip:todo]
In this example, the API returns a single result that matches the specified
score and time constraints:
[source,js]
----
{
"count": 1,
"overall_buckets": [
{
"timestamp" : 1403532000000,
"bucket_span" : 3600,
"overall_score" : 40.0,
"jobs" : [
{
"job_id" : "job-1",
"max_anomaly_score" : 30.0
},
{
"job_id" : "job-2",
"max_anomaly_score" : 10.0
},
{
"job_id" : "job-3",
"max_anomaly_score" : 80.0
}
],
"is_interim" : false,
"result_type" : "overall_bucket"
}
]
}
----