x-pack-info.asciidoc 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. [[java-rest-high-x-pack-info]]
  2. === X-Pack Info API
  3. [[java-rest-high-x-pack-info-execution]]
  4. ==== Execution
  5. General information about the installed {xpack} features can be retrieved
  6. using the `xPackInfo()` method:
  7. ["source","java",subs="attributes,callouts,macros"]
  8. --------------------------------------------------
  9. include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[x-pack-info-execute]
  10. --------------------------------------------------
  11. <1> Enable verbose mode. The default is `false` but `true` will return
  12. more information.
  13. <2> Set the categories of information to retrieve. The the default is to
  14. return no information which is useful for checking if {xpack} is installed
  15. but not much else.
  16. [[java-rest-high-x-pack-info-response]]
  17. ==== Response
  18. The returned `XPackInfoResponse` can contain `BuildInfo`, `LicenseInfo`,
  19. and `FeatureSetsInfo` depending on the categories requested.
  20. ["source","java",subs="attributes,callouts,macros"]
  21. --------------------------------------------------
  22. include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[x-pack-info-response]
  23. --------------------------------------------------
  24. <1> `BuildInfo` contains the commit hash from which Elasticsearch was
  25. built and the timestamp that the x-pack module was created.
  26. <2> `LicenseInfo` contains the type of license that the cluster is using
  27. and its expiration date.
  28. <3> Basic licenses do not expire and will return this constant.
  29. <4> `FeatureSetsInfo` contains a `Map` from the name of a feature to
  30. information about a feature like whether or not it is available under
  31. the current license.
  32. [[java-rest-high-x-pack-info-async]]
  33. ==== Asynchronous Execution
  34. This request can be executed asynchronously:
  35. ["source","java",subs="attributes,callouts,macros"]
  36. --------------------------------------------------
  37. include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[x-pack-info-execute-async]
  38. --------------------------------------------------
  39. <1> The `XPackInfoRequest` to execute and the `ActionListener` to use when
  40. the execution completes
  41. The asynchronous method does not block and returns immediately. Once it is
  42. completed the `ActionListener` is called back using the `onResponse` method
  43. if the execution successfully completed or using the `onFailure` method if
  44. it failed.
  45. A typical listener for `XPackInfoResponse` looks like:
  46. ["source","java",subs="attributes,callouts,macros"]
  47. --------------------------------------------------
  48. include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[x-pack-info-execute-listener]
  49. --------------------------------------------------
  50. <1> Called when the execution is successfully completed. The response is
  51. provided as an argument
  52. <2> Called in case of failure. The raised exception is provided as an argument