| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 | [[java-rest-high-split-index]]=== Split Index API[[java-rest-high-split-index-request]]==== Resize RequestThe Split API requires a `ResizeRequest` instance.A `ResizeRequest` requires two string arguments:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-request]--------------------------------------------------<1> The target index (first argument) to split the source index (second argument) into<2> The resize type needs to be set to `SPLIT`==== Optional argumentsThe following arguments can optionally be provided:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-request-timeout]--------------------------------------------------<1> Timeout to wait for the all the nodes to acknowledge the index is openedas a `TimeValue`<2> Timeout to wait for the all the nodes to acknowledge the index is openedas a `String`["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-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[split-index-request-waitForActiveShards]--------------------------------------------------<1> The number of active shard copies to wait for before the split index APIreturns a response, as an `int`<2> The number of active shard copies to wait for before the split index APIreturns a response, as an `ActiveShardCount`["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-request-settings]--------------------------------------------------<1> The settings to apply to the target index, which include the number ofshards to create for it["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-request-aliases]--------------------------------------------------<1> The aliases to associate the target index with[[java-rest-high-split-index-sync]]==== Synchronous Execution["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-execute]--------------------------------------------------[[java-rest-high-split-index-async]]==== Asynchronous ExecutionThe asynchronous execution of a split index request requires both the `ResizeRequest`instance and an `ActionListener` instance to be passed to the asynchronousmethod:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-execute-async]--------------------------------------------------<1> The `ResizeRequest` 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 `ResizeResponse` looks like:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-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-split-index-response]]==== Split Index ResponseThe returned `ResizeResponse` allows to retrieve information about theexecuted operation as follows:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-index-response]--------------------------------------------------<1> Indicates whether all of the nodes have acknowledged the request<2> Indicates whether the requisite number of shard copies were started foreach shard in the index before timing out
 |