indices-exists.asciidoc 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 /<target>`
  17. [[indices-exists-api-prereqs]]
  18. ==== {api-prereq-title}
  19. * If the {es} {security-features} are enabled, you must have the
  20. `view_index_metadata` or `manage` <<privileges-list-indices,index privilege>>
  21. for the target data stream, index, or index alias.
  22. [[indices-exists-api-path-params]]
  23. ==== {api-path-parms-title}
  24. `<target>`::
  25. (Optional, string)
  26. Comma-separated list of data streams, indices, and index aliases used to limit
  27. the request. Wildcard expressions (`*`) are supported.
  28. [[indices-exists-api-query-params]]
  29. ==== {api-query-parms-title}
  30. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  31. +
  32. Defaults to `true`.
  33. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  34. +
  35. Defaults to `open`.
  36. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=flat-settings]
  37. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=include-defaults]
  38. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  39. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
  40. [[indices-exists-api-response-codes]]
  41. ==== {api-response-codes-title}
  42. `200`::
  43. Indicates all specified indices or index aliases exist.
  44. `404`::
  45. Indicates one or more specified indices or index aliases **do not** exist.