1
0

get-record.asciidoc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. [role="xpack"]
  2. [[ml-get-record]]
  3. === Get Records API
  4. ++++
  5. <titleabbrev>Get Records</titleabbrev>
  6. ++++
  7. Retrieves anomaly records for a job.
  8. ==== Request
  9. `GET _xpack/ml/anomaly_detectors/<job_id>/results/records`
  10. //===== Description
  11. ==== Path Parameters
  12. `job_id`::
  13. (string) Identifier for the job.
  14. ==== Request Body
  15. `desc`::
  16. (boolean) If true, the results are sorted in descending order.
  17. `end`::
  18. (string) Returns records with timestamps earlier than this time.
  19. `exclude_interim`::
  20. (boolean) If true, the output excludes interim results.
  21. By default, interim results are included.
  22. `page`::
  23. `from`:::
  24. (integer) Skips the specified number of records.
  25. `size`:::
  26. (integer) Specifies the maximum number of records to obtain.
  27. `record_score`::
  28. (double) Returns records with anomaly scores greater or equal than this value.
  29. `sort`::
  30. (string) Specifies the sort field for the requested records.
  31. By default, the records are sorted by the `anomaly_score` value.
  32. `start`::
  33. (string) Returns records with timestamps after this time.
  34. ==== Results
  35. The API returns the following information:
  36. `records`::
  37. (array) An array of record objects. For more information, see
  38. <<ml-results-records,Records>>.
  39. ==== Authorization
  40. You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
  41. privileges to use this API. You also need `read` index privilege on the index
  42. that stores the results. The `machine_learning_admin` and `machine_learning_user`
  43. roles provide these privileges. For more information, see
  44. {xpack-ref}/security-privileges.html[Security Privileges] and
  45. {xpack-ref}/built-in-roles.html[Built-in Roles].
  46. //<<security-privileges>> and <<built-in-roles>>.
  47. ==== Examples
  48. The following example gets record information for the `it-ops-kpi` job:
  49. [source,js]
  50. --------------------------------------------------
  51. GET _xpack/ml/anomaly_detectors/it-ops-kpi/results/records
  52. {
  53. "sort": "record_score",
  54. "desc": true,
  55. "start": "1454944100000"
  56. }
  57. --------------------------------------------------
  58. // CONSOLE
  59. // TEST[skip:todo]
  60. In this example, the API returns twelve results for the specified
  61. time constraints:
  62. [source,js]
  63. ----
  64. {
  65. "count": 12,
  66. "records": [
  67. {
  68. "job_id": "it-ops-kpi",
  69. "result_type": "record",
  70. "probability": 0.00000332668,
  71. "record_score": 72.9929,
  72. "initial_record_score": 65.7923,
  73. "bucket_span": 300,
  74. "detector_index": 0,
  75. "is_interim": false,
  76. "timestamp": 1454944200000,
  77. "function": "low_sum",
  78. "function_description": "sum",
  79. "typical": [
  80. 1806.48
  81. ],
  82. "actual": [
  83. 288
  84. ],
  85. "field_name": "events_per_min"
  86. },
  87. ...
  88. ]
  89. }
  90. ----