get-influencer.asciidoc 5.2 KB

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