2017-04-11 21:52:47 -04:00
|
|
|
//lcawley: Verified example output 2017-04-11
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-post-data]]
|
|
|
|
==== Post Data to Jobs
|
|
|
|
|
|
|
|
The post data API allows you to send data to an anomaly detection job for analysis.
|
|
|
|
The job must have been opened prior to sending data.
|
|
|
|
|
|
|
|
===== Request
|
|
|
|
|
2017-04-06 10:56:46 -04:00
|
|
|
`POST _xpack/ml/anomaly_detectors/<job_id>/_data --data-binary @<data-file.json>`
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
===== Description
|
|
|
|
|
|
|
|
File sizes are limited to 100 Mb, so if your file is larger,
|
|
|
|
then split it into multiple files and upload each one separately in sequential time order.
|
|
|
|
When running in real-time, it is generally recommended to arrange to perform
|
|
|
|
many small uploads, rather than queueing data to upload larger files.
|
|
|
|
|
|
|
|
IMPORTANT: Data can only be accepted from a single connection.
|
2017-04-11 21:52:47 -04:00
|
|
|
Use a single connection synchronously to send data, close, flush, or delete a single job.
|
|
|
|
It is not currently possible to post data to multiple jobs using wildcards
|
|
|
|
or a comma separated list.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-18 18:13:21 -04:00
|
|
|
You must have `manage_ml`, or `manage` cluster privileges to use this API.
|
|
|
|
For more information, see <<privileges-list-cluster>>.
|
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Path Parameters
|
|
|
|
|
|
|
|
`job_id` (required)::
|
2017-04-18 18:13:21 -04:00
|
|
|
(string) Identifier for the job
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
===== Request Body
|
|
|
|
|
|
|
|
`reset_start`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Specifies the start of the bucket resetting range
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`reset_end`::
|
2017-04-18 18:13:21 -04:00
|
|
|
(string) Specifies the end of the bucket resetting range
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
////
|
|
|
|
===== Responses
|
|
|
|
|
|
|
|
|
|
|
|
200
|
|
|
|
(EmptyResponse) The cluster has been successfully deleted
|
|
|
|
404
|
|
|
|
(BasicFailedReply) The cluster specified by {cluster_id} cannot be found (code: clusters.cluster_not_found)
|
|
|
|
412
|
|
|
|
(BasicFailedReply) The Elasticsearch cluster has not been shutdown yet (code: clusters.cluster_plan_state_error)
|
|
|
|
|
|
|
|
The following example sends data from file `data-file.json` to a job called `my_analysis`.
|
|
|
|
////
|
|
|
|
===== Examples
|
|
|
|
|
2017-04-06 10:56:46 -04:00
|
|
|
The following example posts data from the farequote.json file to the `farequote` job:
|
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2017-04-06 10:56:46 -04:00
|
|
|
$ curl -s -H "Content-type: application/json"
|
2017-04-11 21:52:47 -04:00
|
|
|
-X POST http:\/\/localhost:9200/_xpack/ml/anomaly_detectors/it_ops_new_kpi/_data
|
|
|
|
--data-binary @it_ops_new_kpi.json
|
2017-04-04 18:26:39 -04:00
|
|
|
--------------------------------------------------
|
2017-04-06 10:56:46 -04:00
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
//TBD: Create example of how to post a small data example in Kibana?
|
|
|
|
|
2017-04-06 10:56:46 -04:00
|
|
|
When the data is sent, you receive information about the operational progress of the job.
|
|
|
|
For example:
|
|
|
|
----
|
|
|
|
{
|
2017-04-11 21:52:47 -04:00
|
|
|
"job_id":"it_ops_new_kpi",
|
|
|
|
"processed_record_count":21435,
|
|
|
|
"processed_field_count":64305,
|
|
|
|
"input_bytes":2589063,
|
|
|
|
"input_field_count":85740,
|
2017-04-06 10:56:46 -04:00
|
|
|
"invalid_date_count":0,
|
|
|
|
"missing_field_count":0,
|
|
|
|
"out_of_order_timestamp_count":0,
|
2017-04-11 21:52:47 -04:00
|
|
|
"empty_bucket_count":16,
|
2017-04-06 10:56:46 -04:00
|
|
|
"sparse_bucket_count":0,
|
2017-04-11 21:52:47 -04:00
|
|
|
"bucket_count":2165,
|
|
|
|
"earliest_record_timestamp":1454020569000,
|
|
|
|
"latest_record_timestamp":1455318669000,
|
|
|
|
"last_data_time":1491952300658,
|
|
|
|
"latest_empty_bucket_timestamp":1454541600000,
|
|
|
|
"input_record_count":21435
|
2017-04-06 10:56:46 -04:00
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2017-04-19 13:52:30 -04:00
|
|
|
For more information about these properties, see <<ml-jobstats,Job Stats>>.
|