[[reference-ml-post_data]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    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.postData

Send data to an anomaly detection job for analysis. IMPORTANT: For each job, data can be accepted from only a single connection at a time. It is not currently possible to post data to multiple jobs using wildcards or a comma-separated list.

{ref}/ml-post-data.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(MlPostDataRequest, options?): Promise<MlPostDataResponse>
----

[discrete]
===== `MlPostDataRequest`

[source,ts]
----
interface MlPostDataRequest<TData = unknown> extends <<shared-type-request-base, RequestBase>> {
  job_id: <<shared-type-id, Id>>
  reset_end?: <<shared-type-date-time, DateTime>>
  reset_start?: <<shared-type-date-time, DateTime>>
  data?: TData[]
}
----

[discrete]
===== `MlPostDataResponse`

[source,ts]
----
interface MlPostDataResponse {
  bucket_count: <<shared-type-long, long>>
  earliest_record_timestamp: <<shared-type-long, long>>
  empty_bucket_count: <<shared-type-long, long>>
  input_bytes: <<shared-type-long, long>>
  input_field_count: <<shared-type-long, long>>
  input_record_count: <<shared-type-long, long>>
  invalid_date_count: <<shared-type-long, long>>
  job_id: <<shared-type-id, Id>>
  last_data_time: <<shared-type-integer, integer>>
  latest_record_timestamp: <<shared-type-long, long>>
  missing_field_count: <<shared-type-long, long>>
  out_of_order_timestamp_count: <<shared-type-long, long>>
  processed_field_count: <<shared-type-long, long>>
  processed_record_count: <<shared-type-long, long>>
  sparse_bucket_count: <<shared-type-long, long>>
}
----

