mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-04-23 07:35:41 +00:00
58 lines
2.6 KiB
Plaintext
58 lines
2.6 KiB
Plaintext
|
[[java-rest-high-indices-exists]]
|
||
|
=== Indices Exists API
|
||
|
|
||
|
[[java-rest-high-indices-exists-request]]
|
||
|
==== Indices Exists Request
|
||
|
|
||
|
The 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 arguments
|
||
|
Indices 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 Execution
|
||
|
As is the case with many other APIs, the Indices Exists API has an asynchronous variant in the
|
||
|
Java High Level REST Client.
|
||
|
The asynchronous variant returns void and accept an extra `ActionListener` as an argument.
|
||
|
The provided listener will be notified upon request completion or failure.
|
||
|
|
||
|
["source","java",subs="attributes,callouts,macros"]
|
||
|
--------------------------------------------------
|
||
|
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[indices-exists-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-indices-exists-response]]
|
||
|
==== Response
|
||
|
The 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]
|
||
|
--------------------------------------------------
|