stats.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. [[indices-stats]]
  2. == Indices Stats
  3. Indices level stats provide statistics on different operations happening
  4. on an index. The API provides statistics on the index level scope
  5. (though most stats can also be retrieved using node level scope).
  6. The following returns high level aggregation and index level stats for
  7. all indices:
  8. [source,js]
  9. --------------------------------------------------
  10. curl localhost:9200/_stats
  11. --------------------------------------------------
  12. Specific index stats can be retrieved using:
  13. [source,js]
  14. --------------------------------------------------
  15. curl localhost:9200/index1,index2/_stats
  16. --------------------------------------------------
  17. By default, `docs`, `store`, and `indexing`, `get`, and `search` stats
  18. are returned, other stats can be enabled as well:
  19. [horizontal]
  20. `docs`:: The number of docs / deleted docs (docs not yet merged out).
  21. Note, affected by refreshing the index.
  22. `store`:: The size of the index.
  23. `indexing`:: Indexing statistics, can be combined with a comma
  24. separated list of `types` to provide document type level stats.
  25. `get`:: Get statistics, including missing stats.
  26. `search`:: Search statistics, including custom grouping using the
  27. `groups` parameter (search operations can be associated with one or more
  28. groups).
  29. `warmer`:: Warmer statistics.
  30. `merge`:: merge stats.
  31. `flush`:: flush stats.
  32. `refresh`:: refresh stats.
  33. `clear`:: Clears all the flags (first).
  34. Here are some samples:
  35. [source,js]
  36. --------------------------------------------------
  37. # Get back stats for merge and refresh on top of the defaults
  38. curl 'localhost:9200/_stats?merge=true&refresh=true'
  39. # Get back stats just for flush
  40. curl 'localhost:9200/_stats?clear=true&flush=true'
  41. # Get back stats for type1 and type2 documents for the my_index index
  42. curl 'localhost:9200/my_index/_stats?clear=true&indexing=true&types=type1,type2
  43. --------------------------------------------------
  44. The stats returned are aggregated on the index level, with
  45. `primaries` and `total` aggregations. In order to get back shard level
  46. stats, set the `level` parameter to `shards`.
  47. Note, as shards move around the cluster, their stats will be cleared as
  48. they are created on other nodes. On the other hand, even though a shard
  49. "left" a node, that node will still retain the stats that shard
  50. contributed to.
  51. [float]
  52. === Specific stats endpoints
  53. Instead of using flags to indicate which stats to return, specific REST
  54. endpoints can be used, for example:
  55. [source,js]
  56. --------------------------------------------------
  57. # Merge stats across all indices
  58. curl localhost:9200/_stats/merge
  59. # Merge stats for the my_index index
  60. curl localhost:9200/my_index/_stats/merge
  61. # Indexing stats for my_index
  62. curl localhost:9200/my_index/_stats/indexing
  63. # Indexing stats for my_index for my_type1 and my_type2
  64. curl localhost:9200/my_index/_stats/indexing/my_type1,my_type2
  65. --------------------------------------------------