| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 | [[java-rest-high-exists-alias]]=== Exists Alias API[[java-rest-high-exists-alias-request]]==== Exists Alias RequestThe Exists Alias API uses `GetAliasesRequest` as its request object.One or more aliases can be optionally provided either at constructiontime or later on through the relevant setter method.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-request]--------------------------------------------------==== Optional argumentsThe following arguments can optionally be provided:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-request-alias]--------------------------------------------------<1> One or more aliases to look for["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-request-indices]--------------------------------------------------<1> The index or indices that the alias is associated with["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-request-indicesOptions]--------------------------------------------------<1> Setting `IndicesOptions` controls how unavailable indices are resolved andhow wildcard expressions are expanded["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-request-local]--------------------------------------------------<1> The `local` flag (defaults to `false`) controls whether the aliases needto be looked up in the local cluster state or in the cluster state held bythe elected master node[[java-rest-high-exists-alias-sync]]==== Synchronous Execution["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-execute]--------------------------------------------------[[java-rest-high-exists-alias-async]]==== Asynchronous ExecutionThe asynchronous execution of a exists alias request requires both a `GetAliasesRequest`instance and an `ActionListener` instance to be passed to the asynchronousmethod:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-execute-async]--------------------------------------------------<1> The `GetAliasesRequest` to execute and the `ActionListener` to use whenthe execution completesThe asynchronous method does not block and returns immediately. Once it iscompleted the `ActionListener` is called back using the `onResponse` methodif the execution successfully completed or using the `onFailure` method ifit failed.A typical listener for the `Boolean` response looks like:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[exists-alias-listener]--------------------------------------------------<1> Called when the execution is successfully completed. The response isprovided as an argument<2> Called in case of failure. The raised exception is provided as an argument[[java-rest-high-exists-alias-response]]==== Exists Alias ResponseThe Exists Alias API returns a `boolean` that indicates whether the providedalias (or aliases) was found or not.
 |