2018-10-05 11:45:46 -04:00
|
|
|
--
|
|
|
|
:api: post-data
|
|
|
|
:request: PostDataRequest
|
|
|
|
:response: PostDataResponse
|
|
|
|
--
|
2019-09-10 11:26:56 -04:00
|
|
|
[role="xpack"]
|
2018-10-05 11:45:46 -04:00
|
|
|
[id="{upid}-{api}"]
|
2018-09-07 08:04:27 -04:00
|
|
|
=== Post Data API
|
|
|
|
|
|
|
|
The Post Data API provides the ability to post data to an open
|
|
|
|
{ml} job in the cluster.
|
2018-10-05 11:45:46 -04:00
|
|
|
It accepts a +{request}+ object and responds
|
|
|
|
with a +{response}+ object.
|
2018-09-07 08:04:27 -04:00
|
|
|
|
2018-10-05 11:45:46 -04:00
|
|
|
[id="{upid}-{api}-request"]
|
2018-09-07 08:04:27 -04:00
|
|
|
==== Post Data Request
|
|
|
|
|
2018-10-05 11:45:46 -04:00
|
|
|
A +{request}+ object gets created with an existing non-null `jobId`
|
2018-09-07 08:04:27 -04:00
|
|
|
and the `XContentType` being sent. Individual docs can be added
|
|
|
|
incrementally via the `PostDataRequest.JsonBuilder#addDoc` method.
|
2018-10-05 11:45:46 -04:00
|
|
|
These are then serialized and sent in bulk when passed to the +{request}+.
|
2018-09-07 08:04:27 -04:00
|
|
|
|
|
|
|
Alternatively, the serialized bulk content can be set manually, along with its `XContentType`
|
2018-10-05 11:45:46 -04:00
|
|
|
through one of the other +{request}+ constructors.
|
2018-09-07 08:04:27 -04:00
|
|
|
|
|
|
|
Only `XContentType.JSON` and `XContentType.SMILE` are supported.
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:45:46 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request]
|
2018-09-07 08:04:27 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Create a new `PostDataRequest.JsonBuilder` object for incrementally adding documents
|
|
|
|
<2> Add a new document as a `Map<String, Object>` object
|
|
|
|
<3> Add a new document as a serialized JSON formatted String.
|
|
|
|
<4> Constructing a new request referencing an opened `jobId`, and a JsonBuilder
|
|
|
|
|
|
|
|
==== Optional Arguments
|
|
|
|
|
|
|
|
The following arguments are optional.
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:45:46 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-options]
|
2018-09-07 08:04:27 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Set the start of the bucket resetting time
|
|
|
|
<2> Set the end of the bucket resetting time
|
|
|
|
|
2018-10-05 11:45:46 -04:00
|
|
|
include::../execution.asciidoc[]
|
2018-09-07 08:04:27 -04:00
|
|
|
|
2018-10-05 11:45:46 -04:00
|
|
|
[id="{upid}-{api}-response"]
|
2018-09-07 08:04:27 -04:00
|
|
|
==== Post Data Response
|
|
|
|
|
2018-10-05 11:45:46 -04:00
|
|
|
A +{response}+ contains current data processing statistics.
|
2018-09-07 08:04:27 -04:00
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-05 11:45:46 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-response]
|
2018-09-07 08:04:27 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> `getDataCounts()` a `DataCounts` object containing the current
|
|
|
|
data processing counts.
|