elasticsearch/docs/reference/esql/functions/count.asciidoc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
611 B
Plaintext
Raw Normal View History

[discrete]
[[esql-agg-count]]
=== `COUNT`
Counts field values.
[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]
|===
Can take any field type as input and the result is always a `long` not matter
the input type.
To count the number of rows, use `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]
|===