[role="xpack"]
[testenv="platinum"]
[[ml-get-influencer]]
=== Get influencers API
++++
Get influencers
++++
Retrieves {anomaly-job} results for one or more influencers.
[[ml-get-influencer-request]]
==== {api-request-title}
`GET _ml/anomaly_detectors//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 {stack-ov}/security-privileges.html[Security privileges] and
{stack-ov}/built-in-roles.html[Built-in roles].
[[ml-get-influencer-path-parms]]
==== {api-path-parms-title}
``::
(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-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
},
...
]
}
----