count.asciidoc 2.3 KB

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