OpenSearch/docs/java-rest/high-level/indices/indices_exists.asciidoc
Luca Cavanna 9c8ebb608f
Remove flatSettings support from request classes (#29560)
As part of adding support for new API to the high-level REST client,
we added support for the `flat_settings` parameter to some of our
request classes. We added documentation that such flag is only ever
read by the high-level REST client, but the truth is that it doesn't
do anything given that settings are always parsed back into a `Settings`
object, no matter whether they are returned in a flat format or not.

It was a mistake to add support for this flag in the context of the
high-level REST client, hence this commit removes it.
2018-04-17 18:18:21 +02:00

71 lines
3.1 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> 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
The asynchronous execution of an indices exists 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[indices-exists-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 the Indices Exists looks like:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[indices-exists-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-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]
--------------------------------------------------