[[java-rest-high-close-index]] === Close Index API [[java-rest-high-close-index-request]] ==== Close Index Request A `CloseIndexRequest` requires an `index` argument: ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[close-index-request] -------------------------------------------------- <1> The index to close ==== Optional arguments The following arguments can optionally be provided: ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[close-index-request-timeout] -------------------------------------------------- <1> Timeout to wait for the all the nodes to acknowledge the index is closed as a `TimeValue` <2> Timeout to wait for the all the nodes to acknowledge the index is closed as a `String` ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[close-index-request-masterTimeout] -------------------------------------------------- <1> Timeout to connect to the master node as a `TimeValue` <2> Timeout to connect to the master node as a `String` ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[close-index-request-indicesOptions] -------------------------------------------------- <1> Setting `IndicesOptions` controls how unavailable indices are resolved and how wildcard expressions are expanded [[java-rest-high-close-index-sync]] ==== Synchronous Execution ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[close-index-execute] -------------------------------------------------- [[java-rest-high-close-index-async]] ==== Asynchronous Execution ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[close-index-execute-async] -------------------------------------------------- <1> Called when the execution is successfully completed. The response is provided as an argument <2> Called in case of failure. The raised exception is provided as an argument [[java-rest-high-close-index-response]] ==== Close Index Response The returned `CloseIndexResponse` allows to retrieve information about the executed operation as follows: ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[close-index-response] -------------------------------------------------- <1> Indicates whether all of the nodes have acknowledged the request