exists_alias.asciidoc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. [[java-rest-high-exists-alias]]
  2. === Exists Alias API
  3. [[java-rest-high-exists-alias-request]]
  4. ==== Exists Alias Request
  5. The Exists Alias API uses `GetAliasesRequest` as its request object.
  6. One or more aliases can be optionally provided either at construction
  7. time or later on through the relevant setter method.
  8. ["source","java",subs="attributes,callouts,macros"]
  9. --------------------------------------------------
  10. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-request]
  11. --------------------------------------------------
  12. ==== Optional arguments
  13. The following arguments can optionally be provided:
  14. ["source","java",subs="attributes,callouts,macros"]
  15. --------------------------------------------------
  16. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-request-alias]
  17. --------------------------------------------------
  18. <1> One or more aliases to look for
  19. ["source","java",subs="attributes,callouts,macros"]
  20. --------------------------------------------------
  21. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-request-indices]
  22. --------------------------------------------------
  23. <1> The index or indices that the alias is associated with
  24. ["source","java",subs="attributes,callouts,macros"]
  25. --------------------------------------------------
  26. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-request-indicesOptions]
  27. --------------------------------------------------
  28. <1> Setting `IndicesOptions` controls how unavailable indices are resolved and
  29. how wildcard expressions are expanded
  30. ["source","java",subs="attributes,callouts,macros"]
  31. --------------------------------------------------
  32. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-request-local]
  33. --------------------------------------------------
  34. <1> The `local` flag (defaults to `false`) controls whether the aliases need
  35. to be looked up in the local cluster state or in the cluster state held by
  36. the elected master node.
  37. [[java-rest-high-exists-alias-sync]]
  38. ==== Synchronous Execution
  39. ["source","java",subs="attributes,callouts,macros"]
  40. --------------------------------------------------
  41. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-execute]
  42. --------------------------------------------------
  43. [[java-rest-high-exists-alias-async]]
  44. ==== Asynchronous Execution
  45. The asynchronous execution of a exists alias request requires both a `GetAliasesRequest`
  46. instance and an `ActionListener` instance to be passed to the asynchronous
  47. method:
  48. ["source","java",subs="attributes,callouts,macros"]
  49. --------------------------------------------------
  50. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-execute-async]
  51. --------------------------------------------------
  52. <1> The `GetAliasesRequest` to execute and the `ActionListener` to use when
  53. the execution completes
  54. The asynchronous method does not block and returns immediately. Once it is
  55. completed the `ActionListener` is called back using the `onResponse` method
  56. if the execution successfully completed or using the `onFailure` method if
  57. it failed.
  58. A typical listener for the `Boolean` response looks like:
  59. ["source","java",subs="attributes,callouts,macros"]
  60. --------------------------------------------------
  61. include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-listener]
  62. --------------------------------------------------
  63. <1> Called when the execution is successfully completed. The response is
  64. provided as an argument
  65. <2> Called in case of failure. The raised exception is provided as an argument
  66. [[java-rest-high-exists-alias-response]]
  67. ==== Exists Alias Response
  68. The Exists Alias API returns a `boolean` that indicates whether the provided
  69. alias (or aliases) was found or not.