get-influencer.asciidoc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. Requires the `monitor_ml` cluster privilege. This privilege is included in the
  15. `machine_learning_user` built-in role.`
  16. [[ml-get-influencer-desc]]
  17. == {api-description-title}
  18. Influencers are the entities that have contributed to, or are to blame for,
  19. the anomalies. Influencer results are available only if an
  20. `influencer_field_name` is specified in the job configuration.
  21. [[ml-get-influencer-path-parms]]
  22. == {api-path-parms-title}
  23. `<job_id>`::
  24. (Required, string)
  25. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  26. [[ml-get-influencer-request-body]]
  27. == {api-request-body-title}
  28. `desc`::
  29. (Optional, Boolean)
  30. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=desc-results]
  31. `end`::
  32. (Optional, string) Returns influencers with timestamps earlier than this time.
  33. Defaults to `-1`, which means it is unset and results are not limited to
  34. specific timestamps.
  35. `exclude_interim`::
  36. (Optional, Boolean)
  37. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-interim-results]
  38. `influencer_score`::
  39. (Optional, double) Returns influencers with anomaly scores greater than or
  40. equal to this value. Defaults to `0.0`.
  41. `page`.`from`::
  42. (Optional, integer) Skips the specified number of influencers. Defaults to `0`.
  43. `page`.`size`::
  44. (Optional, integer) Specifies the maximum number of influencers to obtain.
  45. 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-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::{es-repo-dir}/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::{es-repo-dir}/ml/ml-shared.asciidoc[tag=is-interim]
  77. `job_id`::
  78. (string)
  79. include::{es-repo-dir}/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::{es-repo-dir}/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. ----