stats.asciidoc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. [[indices-stats]]
  2. === Index stats API
  3. ++++
  4. <titleabbrev>Index stats</titleabbrev>
  5. ++++
  6. Returns statistics for an index.
  7. [source,console]
  8. ----
  9. GET /twitter/_stats
  10. ----
  11. // TEST[setup:twitter]
  12. [[index-stats-api-request]]
  13. ==== {api-request-title}
  14. `GET /<index>/_stats/<index-metric>`
  15. `GET /<index>/_stats`
  16. `GET /_stats`
  17. [[index-stats-api-desc]]
  18. ==== {api-description-title}
  19. Use the index stats API to get high-level aggregation and statistics for an index.
  20. By default,
  21. the returned statistics are index-level
  22. with `primaries` and `total` aggregations.
  23. `primaries` are the values for only the primary shards.
  24. `total` are the accumulated values for both primary and replica shards.
  25. To get shard-level statistics,
  26. set the `level` parameter to `shards`.
  27. [NOTE]
  28. ====
  29. When moving to another node,
  30. the shard-level statistics for a shard are cleared.
  31. Although the shard
  32. is no longer part of the node,
  33. that node retains any node-level statistics
  34. to which the shard contributed.
  35. ====
  36. [[index-stats-api-path-params]]
  37. ==== {api-path-parms-title}
  38. include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
  39. +
  40. To retrieve statistics for all indices,
  41. use a value of `_all` or `*` or omit this parameter.
  42. include::{docdir}/rest-api/common-parms.asciidoc[tag=index-metric]
  43. [[index-stats-api-query-params]]
  44. ==== {api-query-parms-title}
  45. include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  46. +
  47. Defaults to `open`.
  48. include::{docdir}/rest-api/common-parms.asciidoc[tag=fields]
  49. include::{docdir}/rest-api/common-parms.asciidoc[tag=completion-fields]
  50. include::{docdir}/rest-api/common-parms.asciidoc[tag=fielddata-fields]
  51. `forbid_closed_indices`::
  52. (Optional, boolean)
  53. If `true`, statistics are *not* collected from closed indices.
  54. Defaults to `true`.
  55. include::{docdir}/rest-api/common-parms.asciidoc[tag=groups]
  56. include::{docdir}/rest-api/common-parms.asciidoc[tag=level]
  57. include::{docdir}/rest-api/common-parms.asciidoc[tag=include-segment-file-sizes]
  58. include::{docdir}/rest-api/common-parms.asciidoc[tag=include-unloaded-segments]
  59. [[index-stats-api-example]]
  60. ==== {api-examples-title}
  61. [[index-stats-api-multiple-ex]]
  62. ===== Get statistics for multiple indices
  63. [source,console]
  64. --------------------------------------------------
  65. GET /index1,index2/_stats
  66. --------------------------------------------------
  67. // TEST[s/^/PUT index1\nPUT index2\n/]
  68. [[index-stats-api-all-ex]]
  69. ===== Get statistics for all indices
  70. [source,console]
  71. --------------------------------------------------
  72. GET /_stats
  73. --------------------------------------------------
  74. // TEST[setup:twitter]
  75. [[index-stats-api-specific-stats-ex]]
  76. ===== Get specific statistics
  77. The following request returns
  78. only the `merge` and `refresh` statistics
  79. for all indices.
  80. [source,console]
  81. --------------------------------------------------
  82. GET /_stats/merge,refresh
  83. --------------------------------------------------
  84. // TEST[setup:twitter]
  85. [[index-stats-api-specific-groups-ex]]
  86. ===== Get statistics for specific search groups
  87. The following request returns
  88. only search statistics
  89. for the `group1` and `group2` search groups.
  90. [source,console]
  91. --------------------------------------------------
  92. GET /_stats/search?groups=group1,group2
  93. --------------------------------------------------
  94. // TEST[setup:twitter]