close.asciidoc 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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::{docdir}/indices/open-close.asciidoc[tag=closed-index]
  19. [[close-index-api-path-params]]
  20. ==== {api-path-parms-title}
  21. include::{docdir}/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::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  31. include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  32. +
  33. Defaults to `open`.
  34. include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  35. include::{docdir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards]
  36. include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  37. [[close-index-api-example]]
  38. ==== {api-examples-title}
  39. The following example shows how to close an index:
  40. [source,console]
  41. --------------------------------------------------
  42. POST /my_index/_close
  43. --------------------------------------------------
  44. // TEST[s/^/PUT my_index\n/]
  45. The API returns following response:
  46. [source,console-result]
  47. --------------------------------------------------
  48. {
  49. "acknowledged" : true,
  50. "shards_acknowledged" : true,
  51. "indices" : {
  52. "my_index" : {
  53. "closed" : true
  54. }
  55. }
  56. }
  57. --------------------------------------------------