indices.asciidoc 2.9 KB

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