indices.asciidoc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. [[cat-indices]]
  2. === cat indices API
  3. ++++
  4. <titleabbrev>cat indices</titleabbrev>
  5. ++++
  6. [IMPORTANT]
  7. ====
  8. cat APIs are only intended for human consumption using the command line or {kib}
  9. console. They are _not_ intended for use by applications. For application
  10. consumption, use the <<indices-get-index,get index API>>.
  11. ====
  12. Returns high-level information about indices in a cluster, including backing
  13. indices for data streams.
  14. [[cat-indices-api-request]]
  15. ==== {api-request-title}
  16. `GET /_cat/indices/<target>`
  17. `GET /_cat/indices`
  18. [[cat-indices-api-prereqs]]
  19. ==== {api-prereq-title}
  20. * If the {es} {security-features} are enabled, you must have the `monitor` or
  21. `manage` <<privileges-list-cluster,cluster privilege>> to use this API. You must
  22. also have the `monitor` or `manage` <<privileges-list-indices,index privilege>>
  23. for any data stream, index, or alias you retrieve.
  24. [[cat-indices-api-desc]]
  25. ==== {api-description-title}
  26. Use the cat indices API to get the following information for each index in a
  27. cluster:
  28. * Shard count
  29. * Document count
  30. * Deleted document count
  31. * Primary store size
  32. * Total store size of all shards, including shard replicas
  33. These metrics are retrieved directly from
  34. https://lucene.apache.org/core/[Lucene], which {es} uses internally to power
  35. indexing and search. As a result, all document counts include hidden
  36. <<nested,nested>> documents.
  37. To get an accurate count of {es} documents, use the <<cat-count,cat count>> or
  38. <<search-count,count>> APIs.
  39. [[cat-indices-api-path-params]]
  40. ==== {api-path-parms-title}
  41. `<target>`::
  42. (Optional, string) Comma-separated list of data streams, indices, and aliases
  43. used to limit the request. Supports wildcards (`*`). To target all data streams
  44. and indices, omit this parameter or use `*` or `_all`.
  45. [[cat-indices-api-query-params]]
  46. ==== {api-query-parms-title}
  47. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bytes]
  48. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  49. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  50. `health`::
  51. +
  52. --
  53. (Optional, string) Health status used to limit returned indices. Valid values
  54. are:
  55. * `green`
  56. * `yellow`
  57. * `red`
  58. By default, the response includes indices of any health status.
  59. --
  60. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
  61. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=include-unloaded-segments]
  62. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  63. [[pri-flag]]
  64. `pri` (primary shards)::
  65. (Optional, Boolean) If `true`, the response only includes information from
  66. primary shards. Defaults to `false`.
  67. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  68. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=time]
  69. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  70. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  71. [[cat-indices-api-example]]
  72. ==== {api-examples-title}
  73. [[examples]]
  74. [source,console]
  75. --------------------------------------------------
  76. GET /_cat/indices/my-index-*?v=true&s=index
  77. --------------------------------------------------
  78. // TEST[setup:my_index_huge]
  79. // TEST[s/^/PUT my-index-000002\n{"settings": {"number_of_replicas": 0}}\n/]
  80. The API returns the following response:
  81. [source,txt]
  82. --------------------------------------------------
  83. health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
  84. yellow open my-index-000001 u8FNjxh8Rfy_awN11oDKYQ 1 1 1200 0 88.1kb 88.1kb
  85. green open my-index-000002 nYFWZEO7TUiOjLQXBaYJpA 1 0 0 0 260b 260b
  86. --------------------------------------------------
  87. // TESTRESPONSE[s/\d+(\.\d+)?[tgmk]?b/\\d+(\\.\\d+)?[tgmk]?b/]
  88. // TESTRESPONSE[s/u8FNjxh8Rfy_awN11oDKYQ|nYFWZEO7TUiOjLQXBaYJpA/.+/ non_json]