count.asciidoc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. [[cat-count]]
  2. === cat count API
  3. ++++
  4. <titleabbrev>cat count</titleabbrev>
  5. ++++
  6. Provides quick access to a document count of individual indices or all indices
  7. in a cluster.
  8. NOTE: The document count only includes live documents, not deleted documents
  9. which have not yet been removed by the merge process.
  10. [[cat-count-api-request]]
  11. ==== {api-request-title}
  12. `GET /_cat/count/<index>`
  13. `GET /_cat/count`
  14. [[cat-count-api-path-params]]
  15. ==== {api-path-parms-title}
  16. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
  17. [[cat-count-api-query-params]]
  18. ==== {api-query-parms-title}
  19. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  20. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  21. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
  22. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  23. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  24. [[cat-count-api-example]]
  25. ==== {api-examples-title}
  26. [[cat-count-api-example-ind]]
  27. ===== Example with an individual index
  28. The following `count` API request retrieves the document count of a single
  29. index, `twitter`.
  30. [source,console,id=cat-count-individual-example]
  31. --------------------------------------------------
  32. GET /_cat/count/twitter?v
  33. --------------------------------------------------
  34. // TEST[setup:big_twitter]
  35. The API returns the following response:
  36. [source,txt]
  37. --------------------------------------------------
  38. epoch timestamp count
  39. 1475868259 15:24:20 120
  40. --------------------------------------------------
  41. // TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]
  42. [[cat-count-api-example-all]]
  43. ===== Example with all indices in a cluster
  44. The following `count` API request retrieves the document count of all indices in
  45. the cluster.
  46. [source,console,id=cat-count-all-example]
  47. --------------------------------------------------
  48. GET /_cat/count?v
  49. --------------------------------------------------
  50. // TEST[setup:big_twitter]
  51. // TEST[s/^/POST test\/_doc\?refresh\n{"test": "test"}\n/]
  52. The API returns the following response:
  53. [source,txt]
  54. --------------------------------------------------
  55. epoch timestamp count
  56. 1475868259 15:24:20 121
  57. --------------------------------------------------
  58. // TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]