put_pipeline.asciidoc 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. [[java-rest-high-ingest-put-pipeline]]
  2. === Put Pipeline API
  3. [[java-rest-high-ingest-put-pipeline-request]]
  4. ==== Put Pipeline Request
  5. A `PutPipelineRequest` requires an `id` argument, a source and a `XContentType`. The source consists
  6. of a description and a list of `Processor` objects.
  7. ["source","java",subs="attributes,callouts,macros"]
  8. --------------------------------------------------
  9. include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-request]
  10. --------------------------------------------------
  11. <1> The pipeline id
  12. <2> The source for the pipeline as a `ByteArray`.
  13. <3> The XContentType for the pipeline source supplied above.
  14. ==== Optional arguments
  15. The following arguments can optionally be provided:
  16. ["source","java",subs="attributes,callouts,macros"]
  17. --------------------------------------------------
  18. include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-request-timeout]
  19. --------------------------------------------------
  20. <1> Timeout to wait for the all the nodes to acknowledge the pipeline creation as a `TimeValue`
  21. <2> Timeout to wait for the all the nodes to acknowledge the pipeline creation as a `String`
  22. ["source","java",subs="attributes,callouts,macros"]
  23. --------------------------------------------------
  24. include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-request-masterTimeout]
  25. --------------------------------------------------
  26. <1> Timeout to connect to the master node as a `TimeValue`
  27. <2> Timeout to connect to the master node as a `String`
  28. [[java-rest-high-ingest-put-pipeline-sync]]
  29. ==== Synchronous Execution
  30. ["source","java",subs="attributes,callouts,macros"]
  31. --------------------------------------------------
  32. include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-execute]
  33. --------------------------------------------------
  34. <1> Execute the request and get back the response in a WritePipelineResponse object.
  35. [[java-rest-high-ingest-put-pipeline-async]]
  36. ==== Asynchronous Execution
  37. The asynchronous execution of a put pipeline request requires both the `PutPipelineRequest`
  38. instance and an `ActionListener` instance to be passed to the asynchronous
  39. method:
  40. ["source","java",subs="attributes,callouts,macros"]
  41. --------------------------------------------------
  42. include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-execute-async]
  43. --------------------------------------------------
  44. <1> The `PutPipelineRequest` to execute and the `ActionListener` to use when
  45. the execution completes
  46. The asynchronous method does not block and returns immediately. Once it is
  47. completed the `ActionListener` is called back using the `onResponse` method
  48. if the execution successfully completed or using the `onFailure` method if
  49. it failed.
  50. A typical listener for `WritePipelineResponse` looks like:
  51. ["source","java",subs="attributes,callouts,macros"]
  52. --------------------------------------------------
  53. include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-execute-listener]
  54. --------------------------------------------------
  55. <1> Called when the execution is successfully completed. The response is
  56. provided as an argument
  57. <2> Called in case of failure. The raised exception is provided as an argument
  58. [[java-rest-high-ingest-put-pipeline-response]]
  59. ==== Put Pipeline Response
  60. The returned `WritePipelineResponse` allows to retrieve information about the executed
  61. operation as follows:
  62. ["source","java",subs="attributes,callouts,macros"]
  63. --------------------------------------------------
  64. include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-response]
  65. --------------------------------------------------
  66. <1> Indicates whether all of the nodes have acknowledged the request