elasticsearch/docs/reference/esql/functions/count.asciidoc
Abdon Pijpelink 8e0d4e1846
[DOCS] Improve ES|QL functions reference for functions A-D (#103447)
* Functions starting with A

* Functions starting with 'C'

* More 'C' functions

* Fix tests

* Fix missing snippet

* DATE_* functions

* Apply suggestions from code review

Co-authored-by: Bogdan Pintea <pintea@mailbox.org>

---------

Co-authored-by: Bogdan Pintea <pintea@mailbox.org>
2023-12-19 15:59:02 +01:00

46 lines
829 B
Text

[discrete]
[[esql-agg-count]]
=== `COUNT`
*Syntax*
[source,esql]
----
COUNT([input])
----
*Parameters*
`input`::
Column or literal for which to count the number of values. If omitted, returns a
count all (the number of rows).
*Description*
Returns the total number (count) of input values.
*Supported types*
Can take any field type as input.
*Examples*
[source.merge.styled,esql]
----
include::{esql-specs}/stats.csv-spec[tag=count]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/stats.csv-spec[tag=count-result]
|===
To count the number of rows, use `COUNT()` or `COUNT(*)`:
[source.merge.styled,esql]
----
include::{esql-specs}/docs.csv-spec[tag=countAll]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/docs.csv-spec[tag=countAll-result]
|===