| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 | [[java-rest-high-indices-exists]]=== Indices Exists API[[java-rest-high-indices-exists-request]]==== Indices Exists RequestThe high-level REST client uses a `GetIndexRequest` for Indices Exists API. The index name (or indices' names) are required.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[indices-exists-request]--------------------------------------------------<1> Index[[java-rest-high-indices-exists-optional-args]]==== Optional argumentsIndices Exists API also accepts following optional arguments, through a `GetIndexRequest`:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[indices-exists-request-optionals]--------------------------------------------------<1> Whether to return local information or retrieve the state from master node<2> Return result in a format suitable for humans<3> Whether to return all default setting for each of the indices<4> Return settings in flat format<5> Controls how unavailable indices are resolved and how wildcard expressions are expanded[[java-rest-high-indices-sync]]==== Synchronous Execution["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[indices-exists-response]--------------------------------------------------[[java-rest-high-indices-async]]==== Asynchronous ExecutionThe asynchronous execution of an indices exists request requires both the`GetIndexRequest` instance and an `ActionListener` instance to be passedto the asynchronous method:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[indices-exists-async]--------------------------------------------------<1> The `GetIndexRequest` 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 Indices Exists looks like:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[indices-exists-execute-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-indices-exists-response]]==== ResponseThe response is a `boolean` value, indicating whether the index (or indices) exist:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[indices-exists-response]--------------------------------------------------
 |