get_job.asciidoc 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. [role="xpack"]
  2. [[java-rest-high-x-pack-rollup-get-job]]
  3. === Get Rollup Job API
  4. experimental::[]
  5. The Get Rollup Job API can be used to get one or all rollup jobs from the
  6. cluster. It accepts a `GetRollupJobRequest` object as a request and returns
  7. a `GetRollupJobResponse`.
  8. [[java-rest-high-x-pack-rollup-get-rollup-job-request]]
  9. ==== Get Rollup Job Request
  10. A `GetRollupJobRequest` can be built without any parameters to get all of the
  11. rollup jobs or with a job name to get a single job:
  12. ["source","java",subs="attributes,callouts,macros"]
  13. --------------------------------------------------
  14. include-tagged::{doc-tests}/RollupDocumentationIT.java[x-pack-rollup-get-rollup-job-request]
  15. --------------------------------------------------
  16. <1> Gets all jobs.
  17. <2> Gets `job_1`.
  18. [[java-rest-high-x-pack-rollup-get-rollup-job-execution]]
  19. ==== Execution
  20. The Get Rollup Job API can be executed through a `RollupClient`
  21. instance. Such instance can be retrieved from a `RestHighLevelClient`
  22. using the `rollup()` method:
  23. ["source","java",subs="attributes,callouts,macros"]
  24. --------------------------------------------------
  25. include-tagged::{doc-tests}/RollupDocumentationIT.java[x-pack-rollup-get-rollup-job-execute]
  26. --------------------------------------------------
  27. [[java-rest-high-x-pack-rollup-get-rollup-job-response]]
  28. ==== Response
  29. The returned `GetRollupJobResponse` includes a `JobWrapper` per returned job
  30. which contains the configuration of the job, the job's current status, and
  31. statistics about the job's past execution.
  32. ["source","java",subs="attributes,callouts,macros"]
  33. --------------------------------------------------
  34. include-tagged::{doc-tests}/RollupDocumentationIT.java[x-pack-rollup-get-rollup-job-response]
  35. --------------------------------------------------
  36. <1> We only asked for a single job
  37. [[java-rest-high-x-pack-rollup-get-rollup-job-async]]
  38. ==== Asynchronous Execution
  39. This request can be executed asynchronously:
  40. ["source","java",subs="attributes,callouts,macros"]
  41. --------------------------------------------------
  42. include-tagged::{doc-tests}/RollupDocumentationIT.java[x-pack-rollup-get-rollup-job-execute-async]
  43. --------------------------------------------------
  44. <1> The `GetRollupJobRequest` 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 `GetRollupJobResponse` looks like:
  51. ["source","java",subs="attributes,callouts,macros"]
  52. --------------------------------------------------
  53. include-tagged::{doc-tests}/RollupDocumentationIT.java[x-pack-rollup-get-rollup-job-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