get_rollup_caps.asciidoc 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. --
  2. :api: rollup-get-rollup-caps
  3. :request: GetRollupCapsRequest
  4. :response: GetRollupCapsResponse
  5. --
  6. [id="{upid}-x-pack-{api}"]
  7. === Get Rollup Capabilities API
  8. The Get Rollup Capabilities API allows the user to query a target index pattern (`logstash-*`, etc)
  9. and determine if there are any rollup jobs that are/were configured to rollup that pattern.
  10. The API accepts a `GetRollupCapsRequest` object as a request and returns a `GetRollupCapsResponse`.
  11. [id="{upid}-x-pack-{api}-request"]
  12. ==== Get Rollup Capabilities Request
  13. A +{request}+ requires a single parameter: the target index or index pattern (e.g. `logstash-*`):
  14. ["source","java",subs="attributes,callouts,macros"]
  15. --------------------------------------------------
  16. include-tagged::{doc-tests-file}[x-pack-{api}-request]
  17. --------------------------------------------------
  18. [id="{upid}-x-pack-{api}-execution"]
  19. ==== Execution
  20. The Get Rollup Capabilities 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-file}[x-pack-{api}-execute]
  26. --------------------------------------------------
  27. [id="{upid}-x-pack-{api}-response"]
  28. ==== Response
  29. The returned +{response}+ holds lists and maps of values which correspond to the capabilities
  30. of the target index/index pattern (what jobs were configured for the pattern, where the data is stored, what
  31. aggregations are available, etc). It provides essentially the same data as the original job configuration,
  32. just presented in a different manner.
  33. For example, if we had created a job with the following config:
  34. ["source","java",subs="attributes,callouts,macros"]
  35. --------------------------------------------------
  36. include-tagged::{doc-tests-file}[x-pack-{api}-setup]
  37. --------------------------------------------------
  38. The +{response}+ object would contain the same information, laid out in a slightly different manner:
  39. ["source","java",subs="attributes,callouts,macros"]
  40. --------------------------------------------------
  41. include-tagged::{doc-tests-file}[x-pack-{api}-response]
  42. --------------------------------------------------
  43. [id="{upid}-x-pack-{api}-async"]
  44. ==== Asynchronous Execution
  45. This request can be executed asynchronously:
  46. ["source","java",subs="attributes,callouts,macros"]
  47. --------------------------------------------------
  48. include-tagged::{doc-tests-file}[x-pack-{api}-execute-async]
  49. --------------------------------------------------
  50. <1> The +{request}+ to execute and the `ActionListener` to use when
  51. the execution completes
  52. The asynchronous method does not block and returns immediately. Once it is
  53. completed the `ActionListener` is called back using the `onResponse` method
  54. if the execution successfully completed or using the `onFailure` method if
  55. it failed.
  56. A typical listener for +{response}+ looks like:
  57. ["source","java",subs="attributes,callouts,macros"]
  58. --------------------------------------------------
  59. include-tagged::{doc-tests-file}[x-pack-{api}-execute-listener]
  60. --------------------------------------------------
  61. <1> Called when the execution is successfully completed. The response is
  62. provided as an argument
  63. <2> Called in case of failure. The raised exception is provided as an argument