indices.asciidoc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. [[cat-indices]]
  2. == cat indices
  3. The `indices` command provides a cross-section of each index. This
  4. information *spans nodes*. For example:
  5. [source,js]
  6. --------------------------------------------------
  7. GET /_cat/indices/twi*?v&s=index
  8. --------------------------------------------------
  9. // CONSOLE
  10. // TEST[setup:huge_twitter]
  11. // TEST[s/^/PUT twitter2\n{"settings": {"number_of_replicas": 0}}\n/]
  12. Might respond with:
  13. [source,txt]
  14. --------------------------------------------------
  15. health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
  16. yellow open twitter u8FNjxh8Rfy_awN11oDKYQ 1 1 1200 0 88.1kb 88.1kb
  17. green open twitter2 nYFWZEO7TUiOjLQXBaYJpA 5 0 0 0 260b 260b
  18. --------------------------------------------------
  19. // TESTRESPONSE[s/\d+(\.\d+)?[tgmk]?b/\\d+(\\.\\d+)?[tgmk]?b/]
  20. // TESTRESPONSE[s/u8FNjxh8Rfy_awN11oDKYQ|nYFWZEO7TUiOjLQXBaYJpA/.+/ _cat]
  21. We can tell quickly how many shards make up an index, the number of
  22. docs, deleted docs, primary store size, and total store size (all shards including replicas).
  23. All these exposed metrics come directly from Lucene APIs.
  24. *Notes:*
  25. 1. As the number of documents and deleted documents shown in this are at the lucene level,
  26. it includes all the hidden documents (e.g. from nested documents) as well.
  27. 2. To get actual count of documents at the elasticsearch level, the recommended way
  28. is to use either the <<cat-count>> or the <<search-count>>
  29. [float]
  30. [[pri-flag]]
  31. === Primaries
  32. The index stats by default will show them for all of an index's
  33. shards, including replicas. A `pri` flag can be supplied to enable
  34. the view of relevant stats in the context of only the primaries.
  35. [float]
  36. [[examples]]
  37. === Examples
  38. Which indices are yellow?
  39. [source,js]
  40. --------------------------------------------------
  41. GET /_cat/indices?v&health=yellow
  42. --------------------------------------------------
  43. // CONSOLE
  44. // TEST[continued]
  45. Which looks like:
  46. [source,txt]
  47. --------------------------------------------------
  48. health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
  49. yellow open twitter u8FNjxh8Rfy_awN11oDKYQ 1 1 1200 0 88.1kb 88.1kb
  50. --------------------------------------------------
  51. // TESTRESPONSE[s/\d+(\.\d+)?[tgmk]?b/\\d+(\\.\\d+)?[tgmk]?b/]
  52. // TESTRESPONSE[s/u8FNjxh8Rfy_awN11oDKYQ/.+/ _cat]
  53. Which index has the largest number of documents?
  54. [source,js]
  55. --------------------------------------------------
  56. GET /_cat/indices?v&s=docs.count:desc
  57. --------------------------------------------------
  58. // CONSOLE
  59. // TEST[continued]
  60. Which looks like:
  61. [source,txt]
  62. --------------------------------------------------
  63. health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
  64. yellow open twitter u8FNjxh8Rfy_awN11oDKYQ 1 1 1200 0 88.1kb 88.1kb
  65. green open twitter2 nYFWZEO7TUiOjLQXBaYJpA 5 0 0 0 260b 260b
  66. --------------------------------------------------
  67. // TESTRESPONSE[s/\d+(\.\d+)?[tgmk]?b/\\d+(\\.\\d+)?[tgmk]?b/]
  68. // TESTRESPONSE[s/u8FNjxh8Rfy_awN11oDKYQ|nYFWZEO7TUiOjLQXBaYJpA/.+/ _cat]
  69. How many merge operations have the shards for the `twitter` completed?
  70. [source,js]
  71. --------------------------------------------------
  72. GET /_cat/indices/twitter?pri&v&h=health,index,pri,rep,docs.count,mt
  73. --------------------------------------------------
  74. // CONSOLE
  75. // TEST[continued]
  76. Might look like:
  77. [source,js]
  78. --------------------------------------------------
  79. health index pri rep docs.count mt pri.mt
  80. yellow twitter 1 1 1200 16 16
  81. --------------------------------------------------
  82. // TESTRESPONSE[s/16/\\d+/ _cat]
  83. How much memory is used per index?
  84. [source,js]
  85. --------------------------------------------------
  86. GET /_cat/indices?v&h=i,tm&s=tm:desc
  87. --------------------------------------------------
  88. // CONSOLE
  89. // TEST[continued]
  90. Might look like:
  91. [source,js]
  92. --------------------------------------------------
  93. i tm
  94. twitter 8.1gb
  95. twitter2 30.5kb
  96. --------------------------------------------------
  97. // TESTRESPONSE[s/\d+(\.\d+)?[tgmk]?b/\\d+(\\.\\d+)?[tgmk]?b/]
  98. // TESTRESPONSE[_cat]