indices.asciidoc 3.3 KB

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