close.asciidoc 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. [[indices-close]]
  2. === Close index API
  3. ++++
  4. <titleabbrev>Close index</titleabbrev>
  5. ++++
  6. Closes an index.
  7. [source,console]
  8. --------------------------------------------------
  9. POST /twitter/_close
  10. --------------------------------------------------
  11. // TEST[setup:twitter]
  12. [[close-index-api-request]]
  13. ==== {api-request-title}
  14. `POST /<index>/_close`
  15. [[close-index-api-desc]]
  16. ==== {api-description-title}
  17. You use the close index API to close open indices.
  18. include::{es-repo-dir}/indices/open-close.asciidoc[tag=closed-index]
  19. [[close-index-api-path-params]]
  20. ==== {api-path-parms-title}
  21. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
  22. +
  23. To close all indices, use `_all` or `*`.
  24. To disallow the closing of indices with `_all` or wildcard expressions,
  25. change the `action.destructive_requires_name` cluster setting to `true`.
  26. You can update this setting in the `elasticsearch.yml` file
  27. or using the <<cluster-update-settings,cluster update settings>> API.
  28. [[close-index-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=index-ignore-unavailable]
  37. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards]
  38. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  39. [[close-index-api-example]]
  40. ==== {api-examples-title}
  41. The following example shows how to close an index:
  42. [source,console]
  43. --------------------------------------------------
  44. POST /my_index/_close
  45. --------------------------------------------------
  46. // TEST[s/^/PUT my_index\n/]
  47. The API returns following response:
  48. [source,console-result]
  49. --------------------------------------------------
  50. {
  51. "acknowledged" : true,
  52. "shards_acknowledged" : true,
  53. "indices" : {
  54. "my_index" : {
  55. "closed" : true
  56. }
  57. }
  58. }
  59. --------------------------------------------------