[[reference-ml-get_records]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////

[discrete]
=== client.ml.getRecords

Get anomaly records for an anomaly detection job. Records contain the detailed analytical results. They describe the anomalous activity that has been identified in the input data based on the detector configuration. There can be many anomaly records depending on the characteristics and size of the input data. In practice, there are often too many to be able to manually process them. The machine learning features therefore perform a sophisticated aggregation of the anomaly records into buckets. The number of record results depends on the number of anomalies found in each bucket, which relates to the number of time series being modeled and the number of detectors.

{ref}/ml-get-record.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(MlGetRecordsRequest, options?): Promise<MlGetRecordsResponse>
----

[discrete]
===== `MlGetRecordsRequest`

[source,ts]
----
interface MlGetRecordsRequest extends <<shared-type-request-base, RequestBase>> {
  job_id: <<shared-type-id, Id>>
  from?: <<shared-type-integer, integer>>
  size?: <<shared-type-integer, integer>>
  desc?: boolean
  end?: <<shared-type-date-time, DateTime>>
  exclude_interim?: boolean
  page?: MlPage
  record_score?: <<shared-type-double, double>>
  sort?: <<shared-type-field, Field>>
  start?: <<shared-type-date-time, DateTime>>
}
----

[discrete]
===== `MlGetRecordsResponse`

[source,ts]
----
interface MlGetRecordsResponse {
  count: <<shared-type-long, long>>
  records: MlAnomaly[]
}
----

