61 lines
2.1 KiB
Plaintext
61 lines
2.1 KiB
Plaintext
--
|
|
:api: post-data
|
|
:request: PostDataRequest
|
|
:response: PostDataResponse
|
|
--
|
|
[role="xpack"]
|
|
[id="{upid}-{api}"]
|
|
=== Post data API
|
|
|
|
The post data API provides the ability to post data to an open
|
|
{ml} job in the cluster.
|
|
It accepts a +{request}+ object and responds
|
|
with a +{response}+ object.
|
|
|
|
[id="{upid}-{api}-request"]
|
|
==== Post data request
|
|
|
|
A +{request}+ object gets created with an existing non-null `jobId`
|
|
and the `XContentType` being sent. Individual docs can be added
|
|
incrementally via the `PostDataRequest.JsonBuilder#addDoc` method.
|
|
These are then serialized and sent in bulk when passed to the +{request}+.
|
|
|
|
Alternatively, the serialized bulk content can be set manually, along with its `XContentType`
|
|
through one of the other +{request}+ constructors.
|
|
|
|
Only `XContentType.JSON` and `XContentType.SMILE` are supported.
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests-file}[{api}-request]
|
|
--------------------------------------------------
|
|
<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"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests-file}[{api}-request-options]
|
|
--------------------------------------------------
|
|
<1> Set the start of the bucket resetting time
|
|
<2> Set the end of the bucket resetting time
|
|
|
|
include::../execution.asciidoc[]
|
|
|
|
[id="{upid}-{api}-response"]
|
|
==== Post data response
|
|
|
|
A +{response}+ contains current data processing statistics.
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{doc-tests-file}[{api}-response]
|
|
--------------------------------------------------
|
|
<1> `getDataCounts()` a `DataCounts` object containing the current
|
|
data processing counts.
|