get-influencer.asciidoc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-influencer]]
  4. = Get influencers API
  5. ++++
  6. <titleabbrev>Get influencers</titleabbrev>
  7. ++++
  8. Retrieves {anomaly-job} results for one or more influencers.
  9. [[ml-get-influencer-request]]
  10. == {api-request-title}
  11. `GET _ml/anomaly_detectors/<job_id>/results/influencers`
  12. [[ml-get-influencer-prereqs]]
  13. == {api-prereq-title}
  14. * If the {es} {security-features} are enabled, you must have `monitor_ml`,
  15. `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. You also
  16. need `read` index privilege on the index that stores the results. The
  17. `machine_learning_admin` and `machine_learning_user` roles provide these
  18. privileges. See <<security-privileges>> and
  19. <<built-in-roles>>.
  20. [[ml-get-influencer-desc]]
  21. == {api-description-title}
  22. Influencers are the entities that have contributed to, or are to blame for,
  23. the anomalies. Influencer results are available only if an
  24. `influencer_field_name` is specified in the job configuration.
  25. [[ml-get-influencer-path-parms]]
  26. == {api-path-parms-title}
  27. `<job_id>`::
  28. (Required, string)
  29. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  30. [[ml-get-influencer-request-body]]
  31. == {api-request-body-title}
  32. `desc`::
  33. (Optional, boolean)
  34. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=desc-results]
  35. `end`::
  36. (Optional, string) Returns influencers with timestamps earlier than this time.
  37. `exclude_interim`::
  38. (Optional, boolean)
  39. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-interim-results]
  40. `influencer_score`::
  41. (Optional, double) Returns influencers with anomaly scores greater than or
  42. equal to this value.
  43. `page`.`from`::
  44. (Optional, integer) Skips the specified number of influencers.
  45. `page`.`size`::
  46. (Optional, integer) Specifies the maximum number of influencers to obtain.
  47. `sort`::
  48. (Optional, string) Specifies the sort field for the requested influencers. By
  49. default, the influencers are sorted by the `influencer_score` value.
  50. `start`::
  51. (Optional, string) Returns influencers with timestamps after this time.
  52. [[ml-get-influencer-results]]
  53. == {api-response-body-title}
  54. The API returns an array of influencer objects, which have the following
  55. properties:
  56. `bucket_span`::
  57. (number)
  58. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-span-results]
  59. `influencer_score`::
  60. (number) A normalized score between 0-100, which is based on the probability of
  61. the influencer in this bucket aggregated across detectors. Unlike
  62. `initial_influencer_score`, this value will be updated by a re-normalization
  63. process as new data is analyzed.
  64. `influencer_field_name`::
  65. (string) The field name of the influencer.
  66. `influencer_field_value`::
  67. (string) The entity that influenced, contributed to, or was to blame for the
  68. anomaly.
  69. `initial_influencer_score`::
  70. (number) A normalized score between 0-100, which is based on the probability of
  71. the influencer aggregated across detectors. This is the initial value that was
  72. calculated at the time the bucket was processed.
  73. `is_interim`::
  74. (boolean)
  75. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=is-interim]
  76. `job_id`::
  77. (string)
  78. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  79. `probability`::
  80. (number) The probability that the influencer has this behavior, in the range 0
  81. to 1. For example, 0.0000109783. This value can be held to a high precision of
  82. over 300 decimal places, so the `influencer_score` is provided as a
  83. human-readable and friendly interpretation of this.
  84. `result_type`::
  85. (string) Internal. This value is always set to `influencer`.
  86. `timestamp`::
  87. (date)
  88. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=timestamp-results]
  89. NOTE: Additional influencer properties are added, depending on the fields being
  90. analyzed. For example, if it's analyzing `user_name` as an influencer, then a
  91. field `user_name` is added to the result document. This information enables you to
  92. filter the anomaly results more easily.
  93. [[ml-get-influencer-example]]
  94. == {api-examples-title}
  95. [source,console]
  96. --------------------------------------------------
  97. GET _ml/anomaly_detectors/high_sum_total_sales/results/influencers
  98. {
  99. "sort": "influencer_score",
  100. "desc": true
  101. }
  102. --------------------------------------------------
  103. // TEST[skip:Kibana sample data]
  104. In this example, the API returns the following information, sorted based on the
  105. influencer score in descending order:
  106. [source,js]
  107. ----
  108. {
  109. "count": 189,
  110. "influencers": [
  111. {
  112. "job_id": "high_sum_total_sales",
  113. "result_type": "influencer",
  114. "influencer_field_name": "customer_full_name.keyword",
  115. "influencer_field_value": "Wagdi Shaw",
  116. "customer_full_name.keyword" : "Wagdi Shaw",
  117. "influencer_score": 99.02493,
  118. "initial_influencer_score" : 94.67233079580171,
  119. "probability" : 1.4784807245686567E-10,
  120. "bucket_span" : 3600,
  121. "is_interim" : false,
  122. "timestamp" : 1574661600000
  123. },
  124. ...
  125. ]
  126. }
  127. ----