close.asciidoc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. [[indices-close]]
  2. === Close index API
  3. ++++
  4. <titleabbrev>Close index</titleabbrev>
  5. ++++
  6. Closes an index.
  7. [source,console]
  8. --------------------------------------------------
  9. POST /my-index-000001/_close
  10. --------------------------------------------------
  11. // TEST[setup:my_index]
  12. [[close-index-api-request]]
  13. ==== {api-request-title}
  14. `POST /<index>/_close`
  15. [[close-index-api-prereqs]]
  16. ==== {api-prereq-title}
  17. * If the {es} {security-features} are enabled, you must have the `manage`
  18. <<privileges-list-indices,index privilege>> for the target index or index alias.
  19. [[close-index-api-desc]]
  20. ==== {api-description-title}
  21. You use the close index API to close open indices.
  22. include::{es-repo-dir}/indices/open-close.asciidoc[tag=closed-index]
  23. [[close-index-api-path-params]]
  24. ==== {api-path-parms-title}
  25. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
  26. +
  27. To close all indices, use `_all` or `*`.
  28. By default, you must explicitly name the indices you are closing.
  29. To specify indices to close with `_all`, `*`, or other wildcard
  30. expressions, change the `action.destructive_requires_name` setting to `false`.
  31. You can update this setting in the `elasticsearch.yml` file
  32. or using the <<cluster-update-settings,cluster update settings>> API.
  33. [[close-index-api-query-params]]
  34. ==== {api-query-parms-title}
  35. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  36. +
  37. Defaults to `true`.
  38. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  39. +
  40. Defaults to `open`.
  41. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  42. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards]
  43. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  44. [[close-index-api-example]]
  45. ==== {api-examples-title}
  46. The following example shows how to close an index:
  47. [source,console]
  48. --------------------------------------------------
  49. POST /my-index-000001/_close
  50. --------------------------------------------------
  51. // TEST[s/^/PUT my-index-000001\n/]
  52. The API returns following response:
  53. [source,console-result]
  54. --------------------------------------------------
  55. {
  56. "acknowledged": true,
  57. "shards_acknowledged": true,
  58. "indices": {
  59. "my-index-000001": {
  60. "closed": true
  61. }
  62. }
  63. }
  64. --------------------------------------------------