elasticsearch/docs/reference/indices/indices-exists.asciidoc
2024-12-31 11:32:29 -08:00

67 lines
1.5 KiB
Text

[[indices-exists]]
=== Exists API
++++
<titleabbrev>Exists</titleabbrev>
++++
.New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-indices[Index APIs].
--
Checks if a data stream, index, or alias exists.
[source,console]
----
HEAD my-data-stream
----
// TEST[setup:my_data_stream]
// TEST[teardown:data_stream_cleanup]
[[indices-exists-api-request]]
==== {api-request-title}
`HEAD <target>`
[[indices-exists-api-prereqs]]
==== {api-prereq-title}
* If the {es} {security-features} are enabled, you must have the
`view_index_metadata` or `manage` <<privileges-list-indices,index privilege>>
for the target.
[[indices-exists-api-path-params]]
==== {api-path-parms-title}
`<target>`::
(Optional, string) Comma-separated list of data streams, indices, and aliases.
Supports wildcards (`*`).
[[indices-exists-api-query-params]]
==== {api-query-parms-title}
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
+
Defaults to `true`.
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
+
Defaults to `open`.
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=flat-settings]
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=include-defaults]
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=local]
[[indices-exists-api-response-codes]]
==== {api-response-codes-title}
`200`::
All targets exist.
`404`::
One or more specified targets do not exist.