mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
REST high-level client: add get index API (#31703)
Also added master_timeout parameter for the indices.get spec Relates to #27205
This commit is contained in:
parent
07470c950b
commit
09e8ac8167
8 changed files with 322 additions and 0 deletions
88
docs/java-rest/high-level/indices/get_index.asciidoc
Normal file
88
docs/java-rest/high-level/indices/get_index.asciidoc
Normal file
|
@ -0,0 +1,88 @@
|
|||
[[java-rest-high-get-index]]
|
||||
=== Get Index API
|
||||
|
||||
[[java-rest-high-get-index-request]]
|
||||
==== Get Index Request
|
||||
|
||||
A `GetIndexRequest` requires one or more `index` arguments:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-index-request]
|
||||
--------------------------------------------------
|
||||
<1> The index whose information we want to retrieve
|
||||
|
||||
==== Optional arguments
|
||||
The following arguments can optionally be provided:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-index-request-includeDefaults]
|
||||
--------------------------------------------------
|
||||
<1> If true, defaults will be returned for settings not explicitly set on the index
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-index-request-indicesOptions]
|
||||
--------------------------------------------------
|
||||
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
|
||||
how wildcard expressions are expanded
|
||||
|
||||
[[java-rest-high-get-index-sync]]
|
||||
==== Synchronous Execution
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-index-execute]
|
||||
--------------------------------------------------
|
||||
|
||||
[[java-rest-high-get-index-async]]
|
||||
==== Asynchronous Execution
|
||||
|
||||
The asynchronous execution of a Get Index request requires both the `GetIndexRequest`
|
||||
instance and an `ActionListener` instance to be passed to the asynchronous
|
||||
method:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-index-execute-async]
|
||||
--------------------------------------------------
|
||||
<1> The `GetIndexRequest` to execute and the `ActionListener` to use when
|
||||
the execution completes
|
||||
|
||||
The asynchronous method does not block and returns immediately. Once it is
|
||||
completed the `ActionListener` is called back using the `onResponse` method
|
||||
if the execution successfully completed or using the `onFailure` method if
|
||||
it failed.
|
||||
|
||||
A typical listener for `GetIndexResponse` looks like:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-index-execute-listener]
|
||||
--------------------------------------------------
|
||||
<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-get-index-response]]
|
||||
==== Get Index Response
|
||||
|
||||
The returned `GetIndexResponse` allows to retrieve information about the
|
||||
executed operation as follows:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[get-index-response]
|
||||
--------------------------------------------------
|
||||
<1> Retrieve a Map of different types to `MappingMetadata` for `index`.
|
||||
<2> Retrieve a Map for the properties for document type `doc`.
|
||||
<3> Get the list of aliases for `index`.
|
||||
<4> Get the value for the setting string `index.number_of_shards` for `index`. If the setting was not explicitly
|
||||
specified but was part of the default settings (and includeDefault was `true`) then the default setting would be
|
||||
retrieved.
|
||||
<5> Retrieve all settings for `index`.
|
||||
<6> The `Settings` objects gives more flexibility. Here it is used to extract the setting `index.number_of_shards` as an
|
||||
integer.
|
||||
<7> Get the default setting `index.refresh_interval` (if `includeDefault` was set to `true`). If `includeDefault` was set
|
||||
to `false`, `getIndexResponse.defaultSettings()` will return an empty map.
|
|
@ -78,6 +78,7 @@ Index Management::
|
|||
* <<java-rest-high-indices-put-settings>>
|
||||
* <<java-rest-high-get-settings>>
|
||||
* <<java-rest-high-indices-validate-query>>
|
||||
* <<java-rest-high-get-index>>
|
||||
|
||||
Mapping Management::
|
||||
* <<java-rest-high-put-mapping>>
|
||||
|
@ -114,6 +115,7 @@ include::indices/get_settings.asciidoc[]
|
|||
include::indices/put_template.asciidoc[]
|
||||
include::indices/validate_query.asciidoc[]
|
||||
include::indices/get_templates.asciidoc[]
|
||||
include::indices/get_index.asciidoc[]
|
||||
|
||||
== Cluster APIs
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue