get_rollup_caps.asciidoc 3.3 KB

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