post-data.asciidoc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. --
  2. :api: post-data
  3. :request: PostDataRequest
  4. :response: PostDataResponse
  5. --
  6. [id="{upid}-{api}"]
  7. === Post Data API
  8. The Post Data API provides the ability to post data to an open
  9. {ml} job in the cluster.
  10. It accepts a +{request}+ object and responds
  11. with a +{response}+ object.
  12. [id="{upid}-{api}-request"]
  13. ==== Post Data Request
  14. A +{request}+ object gets created with an existing non-null `jobId`
  15. and the `XContentType` being sent. Individual docs can be added
  16. incrementally via the `PostDataRequest.JsonBuilder#addDoc` method.
  17. These are then serialized and sent in bulk when passed to the +{request}+.
  18. Alternatively, the serialized bulk content can be set manually, along with its `XContentType`
  19. through one of the other +{request}+ constructors.
  20. Only `XContentType.JSON` and `XContentType.SMILE` are supported.
  21. ["source","java",subs="attributes,callouts,macros"]
  22. --------------------------------------------------
  23. include-tagged::{doc-tests-file}[{api}-request]
  24. --------------------------------------------------
  25. <1> Create a new `PostDataRequest.JsonBuilder` object for incrementally adding documents
  26. <2> Add a new document as a `Map<String, Object>` object
  27. <3> Add a new document as a serialized JSON formatted String.
  28. <4> Constructing a new request referencing an opened `jobId`, and a JsonBuilder
  29. ==== Optional Arguments
  30. The following arguments are optional.
  31. ["source","java",subs="attributes,callouts,macros"]
  32. --------------------------------------------------
  33. include-tagged::{doc-tests-file}[{api}-request-options]
  34. --------------------------------------------------
  35. <1> Set the start of the bucket resetting time
  36. <2> Set the end of the bucket resetting time
  37. include::../execution.asciidoc[]
  38. [id="{upid}-{api}-response"]
  39. ==== Post Data Response
  40. A +{response}+ contains current data processing statistics.
  41. ["source","java",subs="attributes,callouts,macros"]
  42. --------------------------------------------------
  43. include-tagged::{doc-tests-file}[{api}-response]
  44. --------------------------------------------------
  45. <1> `getDataCounts()` a `DataCounts` object containing the current
  46. data processing counts.