indices.asciidoc 3.6 KB

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