| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 | [role="xpack"][testenv="platinum"][[ml-get-record]]= Get records API++++<titleabbrev>Get records</titleabbrev>++++Retrieves anomaly records for an {anomaly-job}.[[ml-get-record-request]]== {api-request-title}`GET _ml/anomaly_detectors/<job_id>/results/records`[[ml-get-record-prereqs]]== {api-prereq-title}* If the {es} {security-features} are enabled, you must have `monitor_ml`,`monitor`, `manage_ml`, or `manage` cluster privileges to use this API. You alsoneed `read` index privilege on the index that stores the results. The`machine_learning_admin` and `machine_learning_user` roles provide theseprivileges. See <<security-privileges>>, <<built-in-roles>>, and{ml-docs-setup-privileges}.[[ml-get-record-desc]]== {api-description-title}Records contain the detailed analytical results. They describe the anomalousactivity that has been identified in the input data based on the detectorconfiguration.There can be many anomaly records depending on the characteristics and size ofthe input data. In practice, there are often too many to be able to manuallyprocess them. The {ml-features} therefore perform a sophisticated aggregation ofthe anomaly records into buckets.The number of record results depends on the number of anomalies found in eachbucket, which relates to the number of time series being modeled and the numberof detectors.[[ml-get-record-path-parms]]== {api-path-parms-title}`<job_id>`::(Required, string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection][[ml-get-record-request-body]]== {api-request-body-title}`desc`::(Optional, boolean)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=desc-results]`end`::(Optional, string) Returns records with timestamps earlier than this time.`exclude_interim`::(Optional, boolean)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-interim-results]`page`.`from`::(Optional, integer) Skips the specified number of records.`page`.`size`::(Optional, integer) Specifies the maximum number of records to obtain.`record_score`::(Optional, double) Returns records with anomaly scores greater or equal thanthis value.`sort`::(Optional, string) Specifies the sort field for the requested records. Bydefault, the records are sorted by the `anomaly_score` value.`start`::(Optional, string) Returns records with timestamps after this time.[[ml-get-record-results]]== {api-response-body-title}The API returns an array of record objects, which have the following properties:`actual`::(array) The actual value for the bucket.`bucket_span`::(number)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-span-results]`by_field_name`::(string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=by-field-name]`by_field_value`::(string) The value of `by_field_name`.`causes`::(array) For population analysis, an over field must be specified in the detector.This property contains an array of anomaly records that are the causes for theanomaly that has been identified for the over field. If no over fields exist,this field is not present. This sub-resource contains the most anomalous recordsfor the `over_field_name`. For scalability reasons, a maximum of the 10 mostsignificant causes of the anomaly are returned. As part of the core analytical modeling, these low-level anomaly records are aggregated for their parent overfield record. The causes resource contains similar elements to the recordresource, namely `actual`, `typical`, `geo_results.actual_point`, `geo_results.typical_point`, `*_field_name` and `*_field_value`. Probability andscores are not applicable to causes.`detector_index`::(number) A unique identifier for the detector.`field_name`::(string) Certain functions require a field to operate on, for example, `sum()`.For those functions, this value is the name of the field to be analyzed.`function`::(string) The function in which the anomaly occurs, as specified in the detectorconfiguration. For example, `max`.`function_description`::(string) The description of the function in which the anomaly occurs, asspecified in the detector configuration.`geo_results.actual_point`::(string) The actual value for the bucket formatted as a `geo_point`. If thedetector function is `lat_long`, this is a comma delimited string of thelatitude and longitude.`geo_results.typical_point`::(string) The typical value for the bucket formatted as a `geo_point`. If thedetector function is `lat_long`, this is a comma delimited string of thelatitude and longitude.`influencers`::(array) If `influencers` was specified in the detector configuration, this arraycontains influencers that contributed to or were to blame for an anomaly.`initial_record_score`::(number) A normalized score between 0-100, which is based on the probability ofthe anomalousness of this record. This is the initial value that was calculatedat the time the bucket was processed.`is_interim`::(boolean)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=is-interim]`job_id`::(string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]`over_field_name`::(string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=over-field-name]`over_field_value`::(string) The value of `over_field_name`.`partition_field_name`::(string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=partition-field-name]`partition_field_value`::(string) The value of `partition_field_name`.`probability`::(number) The probability of the individual anomaly occurring, in the range0 to 1. For example, 0.0000772031. This value can be held to a high precisionof over 300 decimal places, so the `record_score` is provided as ahuman-readable and friendly interpretation of this.`multi_bucket_impact`::(number) An indication of how strongly an anomaly is multi bucket or singlebucket. The value is on a scale of `-5.0` to `+5.0` where `-5.0` means theanomaly is purely single bucket and `+5.0` means the anomaly is purely multibucket.`record_score`::(number) A normalized score between 0-100, which is based on the probability ofthe anomalousness of this record. Unlike `initial_record_score`, this value willbe updated by a re-normalization process as new data is analyzed.`result_type`::(string) Internal. This is always set to `record`.`timestamp`::(date)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=timestamp-results]`typical`::(array) The typical value for the bucket, according to analytical modeling.NOTE: Additional record properties are added, depending on the fields beinganalyzed. For example, if it's analyzing `hostname` as a _by field_, then a field`hostname` is added to the result document. This information enables you tofilter the anomaly results more easily.[[ml-get-record-example]]== {api-examples-title}[source,console]--------------------------------------------------GET _ml/anomaly_detectors/low_request_rate/results/records{  "sort": "record_score",  "desc": true,  "start": "1454944100000"}--------------------------------------------------// TEST[skip:Kibana sample data][source,js]----{  "count" : 4,  "records" : [    {      "job_id" : "low_request_rate",      "result_type" : "record",      "probability" : 1.3882308899968812E-4,      "multi_bucket_impact" : -5.0,      "record_score" : 94.98554565630553,      "initial_record_score" : 94.98554565630553,      "bucket_span" : 3600,      "detector_index" : 0,      "is_interim" : false,      "timestamp" : 1577793600000,      "function" : "low_count",      "function_description" : "count",      "typical" : [        28.254208230188834      ],      "actual" : [        0.0      ]    },  ...  ]}----
 |