OpenSearch/docs/reference/ml/anomaly-detection/apis/get-influencer.asciidoc

110 lines
2.9 KiB
Plaintext

[role="xpack"]
[testenv="platinum"]
[[ml-get-influencer]]
=== Get influencers API
++++
<titleabbrev>Get influencers</titleabbrev>
++++
Retrieves {anomaly-job} results for one or more influencers.
[[ml-get-influencer-request]]
==== {api-request-title}
`GET _ml/anomaly_detectors/<job_id>/results/influencers`
[[ml-get-influencer-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. 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. See <<security-privileges>> and
<<built-in-roles>>.
[[ml-get-influencer-path-parms]]
==== {api-path-parms-title}
`<job_id>`::
(Required, string) Identifier for the {anomaly-job}.
[[ml-get-influencer-request-body]]
==== {api-request-body-title}
`desc`::
(Optional, boolean) If true, the results are sorted in descending order.
`end`::
(Optional, string) Returns influencers with timestamps earlier than this time.
`exclude_interim`::
(Optional, boolean) If true, the output excludes interim results. By default,
interim results are included.
`influencer_score`::
(Optional, double) Returns influencers with anomaly scores greater than or
equal to this value.
`page`::
`from`:::
(Optional, integer) Skips the specified number of influencers.
`size`:::
(Optional, integer) Specifies the maximum number of influencers to obtain.
`sort`::
(Optional, string) Specifies the sort field for the requested influencers. By
default, the influencers are sorted by the `influencer_score` value.
`start`::
(Optional, string) Returns influencers with timestamps after this time.
[[ml-get-influencer-results]]
==== {api-response-body-title}
The API returns the following information:
`influencers`::
(array) An array of influencer objects.
For more information, see <<ml-results-influencers,Influencers>>.
[[ml-get-influencer-example]]
==== {api-examples-title}
The following example gets influencer information for the `it_ops_new_kpi` job:
[source,console]
--------------------------------------------------
GET _ml/anomaly_detectors/it_ops_new_kpi/results/influencers
{
"sort": "influencer_score",
"desc": true
}
--------------------------------------------------
// TEST[skip:todo]
In this example, the API returns the following information, sorted based on the
influencer score in descending order:
[source,js]
----
{
"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,
"bucket_span": 600,
"is_interim": false,
"timestamp": 1454943600000
},
...
]
}
----