indices-exists.asciidoc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. [[indices-exists]]
  2. === Index exists API
  3. ++++
  4. <titleabbrev>Index exists</titleabbrev>
  5. ++++
  6. Checks if an index exists.
  7. The returned HTTP status code indicates if the index exists or not.
  8. A `404` means it does not exist, and `200` means it does.
  9. [source,console]
  10. --------------------------------------------------
  11. HEAD /my-index-000001
  12. --------------------------------------------------
  13. // TEST[setup:my_index]
  14. [[indices-exists-api-request]]
  15. ==== {api-request-title}
  16. `HEAD /<index>`
  17. [[indices-exists-api-path-params]]
  18. ==== {api-path-parms-title}
  19. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
  20. +
  21. IMPORTANT: This parameter does not distinguish between an index name and <<indices-aliases,alias>>,
  22. i.e. status code `200` is also returned if an alias exists with that name.
  23. [[indices-exists-api-query-params]]
  24. ==== {api-query-parms-title}
  25. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  26. +
  27. Defaults to `true`.
  28. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  29. +
  30. Defaults to `open`.
  31. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=flat-settings]
  32. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=include-defaults]
  33. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  34. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
  35. [[indices-exists-api-response-codes]]
  36. ==== {api-response-codes-title}
  37. `200`::
  38. Indicates all specified indices or index aliases exist.
  39. `404`::
  40. Indicates one or more specified indices or index aliases **do not** exist.