elasticsearch/docs/reference/esql/functions/examples/date_trunc.asciidoc

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

33 lines
965 B
Plaintext
Raw Normal View History

// This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
*Examples*
[source.merge.styled,esql]
----
include::{esql-specs}/date.csv-spec[tag=docsDateTrunc]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/date.csv-spec[tag=docsDateTrunc-result]
|===
Combine `DATE_TRUNC` with <<esql-stats-by>> to create date histograms. For
example, the number of hires per year:
[source.merge.styled,esql]
----
include::{esql-specs}/date.csv-spec[tag=docsDateTruncHistogram]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/date.csv-spec[tag=docsDateTruncHistogram-result]
|===
Or an hourly error rate:
[source.merge.styled,esql]
----
include::{esql-specs}/conditional.csv-spec[tag=docsCaseHourlyErrorRate]
2023-05-11 23:02:27 +08:00
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/conditional.csv-spec[tag=docsCaseHourlyErrorRate-result]
|===