count.asciidoc 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. [[cat-count-api-path-params]]
  14. ==== {api-path-parms-title}
  15. include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
  16. [[cat-count-api-query-params]]
  17. ==== {api-query-parms-title}
  18. include::{docdir}/rest-api/common-parms.asciidoc[tag=http-format]
  19. include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-h]
  20. include::{docdir}/rest-api/common-parms.asciidoc[tag=help]
  21. include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
  22. include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  23. include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-s]
  24. include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-v]
  25. [[cat-count-api-example]]
  26. ==== {api-examples-title}
  27. [[cat-count-api-example-ind]]
  28. ===== Example with an individual index
  29. The following `count` API request retrieves the document count of a single
  30. index, `twitter`.
  31. [source,console]
  32. --------------------------------------------------
  33. GET /_cat/count/twitter?v
  34. --------------------------------------------------
  35. // TEST[setup:big_twitter]
  36. The API returns the following response:
  37. [source,txt]
  38. --------------------------------------------------
  39. epoch timestamp count
  40. 1475868259 15:24:20 120
  41. --------------------------------------------------
  42. // TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]
  43. [[cat-count-api-example-all]]
  44. ===== Example with all indices in a cluster
  45. The following `count` API request retrieves the document count of all indices in
  46. the cluster.
  47. [source,console]
  48. --------------------------------------------------
  49. GET /_cat/count?v
  50. --------------------------------------------------
  51. // TEST[setup:big_twitter]
  52. // TEST[s/^/POST test\/test\?refresh\n{"test": "test"}\n/]
  53. The API returns the following response:
  54. [source,txt]
  55. --------------------------------------------------
  56. epoch timestamp count
  57. 1475868259 15:24:20 121
  58. --------------------------------------------------
  59. // TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]