2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
2018-08-31 19:49:24 -04:00
|
|
|
[testenv="platinum"]
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-get-influencer]]
|
2020-07-20 16:10:54 -04:00
|
|
|
= Get influencers API
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2018-12-20 13:23:28 -05:00
|
|
|
<titleabbrev>Get influencers</titleabbrev>
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-30 13:52:23 -04:00
|
|
|
Retrieves {anomaly-job} results for one or more influencers.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-influencer-request]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-request-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`GET _ml/anomaly_detectors/<job_id>/results/influencers`
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
[[ml-get-influencer-prereqs]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-prereq-title}
|
2019-06-27 16:58:42 -04:00
|
|
|
|
|
|
|
* 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
|
2020-07-23 19:43:10 -04:00
|
|
|
privileges. See <<security-privileges>>, <<built-in-roles>>, and
|
|
|
|
{ml-docs-setup-privileges}.
|
2019-06-27 16:58:42 -04:00
|
|
|
|
2019-12-31 16:21:17 -05:00
|
|
|
[[ml-get-influencer-desc]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-description-title}
|
2019-12-31 16:21:17 -05:00
|
|
|
|
|
|
|
Influencers are the entities that have contributed to, or are to blame for,
|
|
|
|
the anomalies. Influencer results are available only if an
|
|
|
|
`influencer_field_name` is specified in the job configuration.
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-influencer-path-parms]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-path-parms-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<job_id>`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Required, string)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-influencer-request-body]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-request-body-title}
|
2017-04-10 19:14:26 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`desc`::
|
2019-12-31 16:21:17 -05:00
|
|
|
(Optional, boolean)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=desc-results]
|
2017-04-10 19:14:26 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`end`::
|
2019-12-31 16:21:17 -05:00
|
|
|
(Optional, string) Returns influencers with timestamps earlier than this time.
|
2017-04-10 19:14:26 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`exclude_interim`::
|
2019-12-31 16:21:17 -05:00
|
|
|
(Optional, boolean)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-interim-results]
|
2017-04-24 13:46:17 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`influencer_score`::
|
2019-12-31 16:21:17 -05:00
|
|
|
(Optional, double) Returns influencers with anomaly scores greater than or equal
|
|
|
|
to this value.
|
2017-04-10 19:14:26 -04:00
|
|
|
|
2019-12-31 16:21:17 -05:00
|
|
|
`page`.`from`::
|
|
|
|
(Optional, integer) Skips the specified number of influencers.
|
|
|
|
|
|
|
|
`page`.`size`::
|
|
|
|
(Optional, integer) Specifies the maximum number of influencers to obtain.
|
2017-04-10 19:14:26 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`sort`::
|
2019-12-31 16:21:17 -05:00
|
|
|
(Optional, string) Specifies the sort field for the requested influencers. By
|
|
|
|
default, the influencers are sorted by the `influencer_score` value.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`start`::
|
2019-12-31 16:21:17 -05:00
|
|
|
(Optional, string) Returns influencers with timestamps after this time.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-influencer-results]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-response-body-title}
|
2017-04-10 19:14:26 -04:00
|
|
|
|
2019-12-31 16:21:17 -05:00
|
|
|
The API returns an array of influencer objects, which have the following
|
|
|
|
properties:
|
|
|
|
|
|
|
|
`bucket_span`::
|
|
|
|
(number)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-span-results]
|
2019-12-31 16:21:17 -05:00
|
|
|
|
|
|
|
`influencer_score`::
|
|
|
|
(number) A normalized score between 0-100, which is based on the probability of
|
|
|
|
the influencer in this bucket aggregated across detectors. Unlike
|
|
|
|
`initial_influencer_score`, this value will be updated by a re-normalization
|
|
|
|
process as new data is analyzed.
|
|
|
|
|
|
|
|
`influencer_field_name`::
|
|
|
|
(string) The field name of the influencer.
|
|
|
|
|
|
|
|
`influencer_field_value`::
|
|
|
|
(string) The entity that influenced, contributed to, or was to blame for the
|
|
|
|
anomaly.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-12-31 16:21:17 -05:00
|
|
|
`initial_influencer_score`::
|
|
|
|
(number) A normalized score between 0-100, which is based on the probability of
|
|
|
|
the influencer aggregated across detectors. This is the initial value that was
|
|
|
|
calculated at the time the bucket was processed.
|
|
|
|
|
|
|
|
`is_interim`::
|
|
|
|
(boolean)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=is-interim]
|
2019-12-31 16:21:17 -05:00
|
|
|
|
|
|
|
`job_id`::
|
|
|
|
(string)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
|
2019-12-31 16:21:17 -05:00
|
|
|
|
|
|
|
`probability`::
|
|
|
|
(number) The probability that the influencer has this behavior, in the range 0
|
|
|
|
to 1. This value can be held to a high precision of over 300 decimal places, so
|
|
|
|
the `influencer_score` is provided as a human-readable and friendly
|
|
|
|
interpretation of this.
|
|
|
|
|
|
|
|
`result_type`::
|
|
|
|
(string) Internal. This value is always set to `influencer`.
|
|
|
|
|
|
|
|
`timestamp`::
|
|
|
|
(date)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=timestamp-results]
|
2019-12-31 16:21:17 -05:00
|
|
|
|
|
|
|
NOTE: Additional influencer properties are added, depending on the fields being
|
|
|
|
analyzed. For example, if it's analyzing `user_name` as an influencer, then a
|
|
|
|
field `user_name` is added to the result document. This information enables you to
|
|
|
|
filter the anomaly results more easily.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-influencer-example]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-examples-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2017-04-10 19:14:26 -04:00
|
|
|
--------------------------------------------------
|
2019-12-31 16:21:17 -05:00
|
|
|
GET _ml/anomaly_detectors/high_sum_total_sales/results/influencers
|
2017-04-10 19:14:26 -04:00
|
|
|
{
|
|
|
|
"sort": "influencer_score",
|
|
|
|
"desc": true
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2019-12-31 16:21:17 -05:00
|
|
|
// TEST[skip:Kibana sample data]
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
In this example, the API returns the following information, sorted based on the
|
|
|
|
influencer score in descending order:
|
2017-04-21 11:23:27 -04:00
|
|
|
[source,js]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
2019-12-31 16:21:17 -05:00
|
|
|
"count": 189,
|
2017-04-10 19:14:26 -04:00
|
|
|
"influencers": [
|
|
|
|
{
|
2019-12-31 16:21:17 -05:00
|
|
|
"job_id": "high_sum_total_sales",
|
2017-04-10 19:14:26 -04:00
|
|
|
"result_type": "influencer",
|
2019-12-31 16:21:17 -05:00
|
|
|
"influencer_field_name": "customer_full_name.keyword",
|
|
|
|
"influencer_field_value": "Wagdi Shaw",
|
|
|
|
"customer_full_name.keyword" : "Wagdi Shaw",
|
|
|
|
"influencer_score": 99.02493,
|
|
|
|
"initial_influencer_score" : 94.67233079580171,
|
|
|
|
"probability" : 1.4784807245686567E-10,
|
|
|
|
"bucket_span" : 3600,
|
|
|
|
"is_interim" : false,
|
|
|
|
"timestamp" : 1574661600000
|
2017-04-10 19:14:26 -04:00
|
|
|
},
|
|
|
|
...
|
2017-04-04 18:26:39 -04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|