elasticsearch/docs/reference/indices/indices-exists.asciidoc

67 lines
1.7 KiB
Plaintext

[[indices-exists]]
=== Index exists API
++++
<titleabbrev>Index exists</titleabbrev>
++++
Checks if an index exists.
The returned HTTP status code indicates if the index exists or not.
A `404` means it does not exist, and `200` means it does.
[source,console]
--------------------------------------------------
HEAD /my-index-000001
--------------------------------------------------
// TEST[setup:my_index]
[[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 data stream, index, or index alias.
[[indices-exists-api-path-params]]
==== {api-path-parms-title}
`<target>`::
(Optional, string)
Comma-separated list of data streams, indices, and index aliases used to limit
the request. Wildcard expressions (`*`) are supported.
[[indices-exists-api-query-params]]
==== {api-query-parms-title}
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
+
Defaults to `true`.
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
+
Defaults to `open`.
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=flat-settings]
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=include-defaults]
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
[[indices-exists-api-response-codes]]
==== {api-response-codes-title}
`200`::
Indicates all specified indices or index aliases exist.
`404`::
Indicates one or more specified indices or index aliases **do not** exist.