get_job.asciidoc 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. [[java-rest-high-x-pack-rollup-get-job]]
  2. === Get Rollup Job API
  3. The Get Rollup Job API can be used to get one or all rollup jobs from the
  4. cluster. It accepts a `GetRollupJobRequest` object as a request and returns
  5. a `GetRollupJobResponse`.
  6. [[java-rest-high-x-pack-rollup-get-rollup-job-request]]
  7. ==== Get Rollup Job Request
  8. A `GetRollupJobRequest` can be built without any parameters to get all of the
  9. rollup jobs or with a job name to get a single job:
  10. ["source","java",subs="attributes,callouts,macros"]
  11. --------------------------------------------------
  12. include-tagged::{doc-tests}/RollupDocumentationIT.java[x-pack-rollup-get-rollup-job-request]
  13. --------------------------------------------------
  14. <1> Gets all jobs.
  15. <2> Gets `job_1`.
  16. [[java-rest-high-x-pack-rollup-get-rollup-job-execution]]
  17. ==== Execution
  18. The Get Rollup Job API can be executed through a `RollupClient`
  19. instance. Such instance can be retrieved from a `RestHighLevelClient`
  20. using the `rollup()` method:
  21. ["source","java",subs="attributes,callouts,macros"]
  22. --------------------------------------------------
  23. include-tagged::{doc-tests}/RollupDocumentationIT.java[x-pack-rollup-get-rollup-job-execute]
  24. --------------------------------------------------
  25. [[java-rest-high-x-pack-rollup-get-rollup-job-response]]
  26. ==== Response
  27. The returned `GetRollupJobResponse` includes a `JobWrapper` per returned job
  28. which contains the configuration of the job, the job's current status, and
  29. statistics about the job's past execution.
  30. ["source","java",subs="attributes,callouts,macros"]
  31. --------------------------------------------------
  32. include-tagged::{doc-tests}/RollupDocumentationIT.java[x-pack-rollup-get-rollup-job-response]
  33. --------------------------------------------------
  34. <1> We only asked for a single job
  35. [[java-rest-high-x-pack-rollup-get-rollup-job-async]]
  36. ==== Asynchronous Execution
  37. This request can be executed asynchronously:
  38. ["source","java",subs="attributes,callouts,macros"]
  39. --------------------------------------------------
  40. include-tagged::{doc-tests}/RollupDocumentationIT.java[x-pack-rollup-get-rollup-job-execute-async]
  41. --------------------------------------------------
  42. <1> The `GetRollupJobRequest` to execute and the `ActionListener` to use when
  43. the execution completes
  44. The asynchronous method does not block and returns immediately. Once it is
  45. completed the `ActionListener` is called back using the `onResponse` method
  46. if the execution successfully completed or using the `onFailure` method if
  47. it failed.
  48. A typical listener for `GetRollupJobResponse` looks like:
  49. ["source","java",subs="attributes,callouts,macros"]
  50. --------------------------------------------------
  51. include-tagged::{doc-tests}/RollupDocumentationIT.java[x-pack-rollup-get-rollup-job-execute-listener]
  52. --------------------------------------------------
  53. <1> Called when the execution is successfully completed. The response is
  54. provided as an argument
  55. <2> Called in case of failure. The raised exception is provided as an argument