REST high-level client: add support for split and shrink index API (#28425)

Relates to #27205
This commit is contained in:
Luca Cavanna 2018-02-01 16:37:01 +01:00 committed by GitHub
parent d37c59d9dd
commit d860971572
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 996 additions and 251 deletions

View file

@ -12,6 +12,10 @@ include::update_aliases.asciidoc[]
include::exists_alias.asciidoc[]
include::shrink_index.asciidoc[]
include::split_index.asciidoc[]
include::_index.asciidoc[]
include::get.asciidoc[]

View file

@ -0,0 +1,90 @@
[[java-rest-high-shrink-index]]
=== Shrink Index API
[[java-rest-high-shrink-index-request]]
==== Resize Request
The Shrink API requires a `ResizeRequest` instance.
A `ResizeRequest` requires two string arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[shrink-index-request]
--------------------------------------------------
<1> The target index (first argument) to shrink the source index (second argument) into
==== Optional arguments
The following arguments can optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[shrink-index-request-timeout]
--------------------------------------------------
<1> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the index is opened
as a `String`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[shrink-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[shrink-index-request-waitForActiveShards]
--------------------------------------------------
<1> The number of active shard copies to wait for before the shrink index API
returns a response, as an `int`
<2> The number of active shard copies to wait for before the shrink index API
returns a response, as an `ActiveShardCount`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[shrink-index-request-settings]
--------------------------------------------------
<1> The settings to apply to the target index, which include the number of
shards to create for it
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[shrink-index-request-aliases]
--------------------------------------------------
<1> The aliases to associate the target index with
[[java-rest-high-shrink-index-sync]]
==== Synchronous Execution
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[shrink-index-execute]
--------------------------------------------------
[[java-rest-high-shrink-index-async]]
==== Asynchronous Execution
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[shrink-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-shrink-index-response]]
==== Shrink Index Response
The returned `ResizeResponse` allows to retrieve information about the
executed operation as follows:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[shrink-index-response]
--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates whether the requisite number of shard copies were started for
each shard in the index before timing out

View file

@ -0,0 +1,91 @@
[[java-rest-high-split-index]]
=== Split Index API
[[java-rest-high-split-index-request]]
==== Resize Request
The 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 arguments
The 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 opened
as a `TimeValue`
<2> Timeout to wait for the all the nodes to acknowledge the index is opened
as 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 API
returns a response, as an `int`.
<2> The number of active shard copies to wait for before the split index API
returns 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 of
shards 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 Execution
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[split-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-split-index-response]]
==== Split Index Response
The returned `ResizeResponse` allows to retrieve information about the
executed 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 for
each shard in the index before timing out

View file

@ -11,6 +11,8 @@ Indices APIs::
* <<java-rest-high-put-mapping>>
* <<java-rest-high-update-aliases>>
* <<java-rest-high-exists-alias>>
* <<java-rest-high-shrink-index>>
* <<java-rest-high-split-index>>
Single document APIs::
* <<java-rest-high-document-index>>