-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[ES|QL][DOCS] Add docs for date_period and time_duration #116368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Documentation preview: |
Pinging @elastic/es-docs (Team:Docs) |
Pinging @elastic/es-analytical-engine (Team:Analytics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, if we introduce a detailed chapter on this (which is great), we can shorten the corresponding paragraph in the syntax reference by skipping the list of supported temporal units and linking in the table from the new chapter?
Also, adding some implicit casting examples would be useful (once that's merged).
Thanks for reviewing @bpintea! I just realized that I didn't update #115814 with your suggestions on the implicit casting docs, my bad, so I include them(implicit-casting.asciidoc) in this doc PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
Thank you for reviewing @bpintea! I'll wait for @leemthompo to take a final look before merging it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Few suggested copyedits from me, will check the URL preview again once updates are made, feel free to ping for re-review :)
|
||
Time spans are often used in datetime related grouping functions like <<esql-bucket, BUCKET>>, scalar functions like <<esql-date_trunc, DATE_TRUNC>> and arithmetic operators like <<esql-add, `+`>> and <<esql-subtract, `-`>>. There are conversions functions that can convert string literals to time spans, <<esql-to_dateperiod, TO_DATEPERIOD>>, <<esql-to_timeduration, TO_TIMEDURATION>> and their corresponding <<esql-cast-operator, cast operators>> `::DATE_PERIOD` and `::TIME_DURATION`. | ||
|
||
==== Examples of using time spans in {esql} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
==== Examples of using time spans in {esql} | |
[discrete] | |
[[esql-time-spans-examples]] | |
==== Examples of using time spans in {esql} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean [[esql-time-spans-examples]]
here? [[esql-time-spans]]
has already been used at the beginning of this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
certainly did! fixed suggestion :)
Thank you for reviewing @leemthompo ! I have updated the branch with your comments, could you help take a look again when you get a chance? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resolves: #112592
We have some descriptions of timespan literals here in the
ES|QL
syntax page, https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-syntax.html#esql-timespan-literalsThis PR is to have a central place to document the usages of
date_period
andtime_duration
with more examples, so that users have a general idea about how they are used in various places inES|QL
.