OpenSearch/docs/en/rest-api/ml/get-influencer.asciidoc

110 lines
2.8 KiB
Plaintext
Raw Normal View History

[[ml-get-influencer]]
==== Get Influencers
The get influencers API enables you to retrieve information about the influencers
in a job.
===== Request
`GET _xpack/ml/anomaly_detectors/<job_id>/results/influencers`
===== Description
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
<<security-privileges>> and <<built-in-roles>>.
===== Path Parameters
`job_id`::
(string) Identifier for the job.
===== Request Body
`desc`::
(boolean) If true, the results are sorted in descending order.
//TBD: Using the "sort" value?
`end`::
(string) Returns influencers with timestamps earlier than this time.
`from`::
(integer) Skips the specified number of influencers.
`include_interim`::
(boolean) If true, the output includes interim results.
`influencer_score`::
(double) Returns influencers with anomaly scores higher than this value.
`size`::
(integer) Specifies the maximum number of influencers to obtain.
`sort`::
(string) Specifies the sort field for the requested influencers.
//TBD: By default the results are sorted on the influencer score?
`start`::
(string) Returns influencers with timestamps after this time.
===== Results
The API returns the following information:
`influencers`::
(array) An array of influencer objects.
For more information, see <<ml-results-influencers,Influencers>>.
////
===== 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)
////
===== Examples
The following example gets influencer information for the `it_ops_new_kpi` job:
[source,js]
--------------------------------------------------
GET _xpack/ml/anomaly_detectors/it_ops_new_kpi/results/influencers
{
"sort": "influencer_score",
"desc": true
}
--------------------------------------------------
// CONSOLE
// TEST[skip:todo]
In this example, the API returns the following information, sorted based on the
influencer score in descending order:
----
{
"count": 28,
"influencers": [
{
"job_id": "it_ops_new_kpi",
"result_type": "influencer",
"influencer_field_name": "kpi_indicator",
"influencer_field_value": "online_purchases",
"kpi_indicator": "online_purchases",
"influencer_score": 94.1386,
"initial_influencer_score": 94.1386,
"probability": 0.000111612,
"sequence_num": 2,
"bucket_span": 600,
"is_interim": false,
"timestamp": 1454943600000
},
...
]
}
----