get_job.asciidoc 2.9 KB

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