get-influencer.asciidoc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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::{docdir}/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::{docdir}/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::{docdir}/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`::
  44. `from`:::
  45. (Optional, integer) Skips the specified number of influencers.
  46. `size`:::
  47. (Optional, integer) Specifies the maximum number of influencers to obtain.
  48. `sort`::
  49. (Optional, string) Specifies the sort field for the requested influencers. By
  50. default, the influencers are sorted by the `influencer_score` value.
  51. `start`::
  52. (Optional, string) Returns influencers with timestamps after this time.
  53. [[ml-get-influencer-results]]
  54. ==== {api-response-body-title}
  55. The API returns an array of influencer objects, which have the following
  56. properties:
  57. `bucket_span`::
  58. (number)
  59. include::{docdir}/ml/ml-shared.asciidoc[tag=bucket-span-results]
  60. `influencer_score`::
  61. (number) A normalized score between 0-100, which is based on the probability of
  62. the influencer in this bucket aggregated across detectors. Unlike
  63. `initial_influencer_score`, this value will be updated by a re-normalization
  64. process as new data is analyzed.
  65. `influencer_field_name`::
  66. (string) The field name of the influencer.
  67. `influencer_field_value`::
  68. (string) The entity that influenced, contributed to, or was to blame for the
  69. anomaly.
  70. `initial_influencer_score`::
  71. (number) A normalized score between 0-100, which is based on the probability of
  72. the influencer aggregated across detectors. This is the initial value that was
  73. calculated at the time the bucket was processed.
  74. `is_interim`::
  75. (boolean)
  76. include::{docdir}/ml/ml-shared.asciidoc[tag=is-interim]
  77. `job_id`::
  78. (string)
  79. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  80. `probability`::
  81. (number) The probability that the influencer has this behavior, in the range 0
  82. to 1. For example, 0.0000109783. This value can be held to a high precision of
  83. over 300 decimal places, so the `influencer_score` is provided as a
  84. human-readable and friendly interpretation of this.
  85. `result_type`::
  86. (string) Internal. This value is always set to `influencer`.
  87. `timestamp`::
  88. (date)
  89. include::{docdir}/ml/ml-shared.asciidoc[tag=timestamp-results]
  90. NOTE: Additional influencer properties are added, depending on the fields being
  91. analyzed. For example, if it's analyzing `user_name` as an influencer, then a
  92. field `user_name` is added to the result document. This information enables you to
  93. filter the anomaly results more easily.
  94. [[ml-get-influencer-example]]
  95. ==== {api-examples-title}
  96. [source,console]
  97. --------------------------------------------------
  98. GET _ml/anomaly_detectors/high_sum_total_sales/results/influencers
  99. {
  100. "sort": "influencer_score",
  101. "desc": true
  102. }
  103. --------------------------------------------------
  104. // TEST[skip:Kibana sample data]
  105. In this example, the API returns the following information, sorted based on the
  106. influencer score in descending order:
  107. [source,js]
  108. ----
  109. {
  110. "count": 189,
  111. "influencers": [
  112. {
  113. "job_id": "high_sum_total_sales",
  114. "result_type": "influencer",
  115. "influencer_field_name": "customer_full_name.keyword",
  116. "influencer_field_value": "Wagdi Shaw",
  117. "customer_full_name.keyword" : "Wagdi Shaw",
  118. "influencer_score": 99.02493,
  119. "initial_influencer_score" : 94.67233079580171,
  120. "probability" : 1.4784807245686567E-10,
  121. "bucket_span" : 3600,
  122. "is_interim" : false,
  123. "timestamp" : 1574661600000
  124. },
  125. ...
  126. ]
  127. }
  128. ----