Skip to content
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

[DOCS] Improve ES|QL functions reference for functions E-Z #104623

Merged

Conversation

abdonpijpelink
Copy link
Contributor

Follow up of #103447

Cleans up the ES|QL function reference, by:

  • applying uniform formatting, in line with commands reference (Syntax/Parameters/Description/Examples)
  • moving examples to spec files so they're tested
  • adding a syntax specification if we don't have a railroad diagram.

@abdonpijpelink abdonpijpelink added >docs General docs changes :Analytics/ES|QL AKA ESQL labels Jan 22, 2024
Copy link
Contributor

Documentation preview:

@elasticsearchmachine elasticsearchmachine added v8.13.0 Team:Docs Meta label for docs team Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Jan 22, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Copy link
Contributor

@alex-spies alex-spies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave this a first go - will continue tomorrow.

docs/reference/esql/functions/count-distinct.asciidoc Outdated Show resolved Hide resolved
docs/reference/esql/functions/greatest.asciidoc Outdated Show resolved Hide resolved
docs/reference/esql/functions/least.asciidoc Outdated Show resolved Hide resolved
docs/reference/esql/functions/left.asciidoc Show resolved Hide resolved
docs/reference/esql/functions/left.asciidoc Outdated Show resolved Hide resolved
docs/reference/esql/functions/length.asciidoc Show resolved Hide resolved
docs/reference/esql/functions/length.asciidoc Show resolved Hide resolved
docs/reference/esql/functions/log10.asciidoc Outdated Show resolved Hide resolved
docs/reference/esql/functions/log10.asciidoc Outdated Show resolved Hide resolved
Comment on lines +14 to +15
`column`::
Column from which to return the maximum value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not have to be a column - it can be an expression.

Copy link
Contributor Author

@abdonpijpelink abdonpijpelink Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got a separate PR brewing that updates the docs for the aggregate functions, now that they support inline expressions. It'll be fixed in that PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that also in other places (aside from aggs), column is used instead of expression - e.g. in mv_dedupe; so it'd probably be best to go over the use of column in all functions and double check, because they generally should accept expressions instead of just field/column names now.

@abdonpijpelink
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@alex-spies alex-spies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Abdon!

Generally LGTM. I mostly have minor remarks, except maybe for the type tables that could be included systematically, I think.

I also made some comments to some text that was only moved - feel free to disregard this for this PR, as it may extend its scope over your initial intention.


Returns the character length of a string.

*Example*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a type table for length now that we should probably include for consistency across our function docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a separate issue about making sure all functions have a railroad diagram and type table: #100558 . I wanted to keep that out of scope for this PR, because it is large enough as it is. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry - of course, let's tackle that in the other issue!

Comment on lines +14 to +15
`column`::
Column from which to return the maximum value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that also in other places (aside from aggs), column is used instead of expression - e.g. in mv_dedupe; so it'd probably be best to go over the use of column in all functions and double check, because they generally should accept expressions instead of just field/column names now.

docs/reference/esql/functions/mv_first.asciidoc Outdated Show resolved Hide resolved
docs/reference/esql/functions/mv_first.asciidoc Outdated Show resolved Hide resolved
docs/reference/esql/functions/sin.asciidoc Outdated Show resolved Hide resolved
docs/reference/esql/functions/substring.asciidoc Outdated Show resolved Hide resolved

*Supported types*

The input type must be of a numeric type and result is always `double`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to_degrees has a type table now that can be included. This applies to multiple other functions (at least the to_... conversion functions) - best to go over them and double check where type tables can be included.


*Description*

Converts an input string to an IP value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "Supported types"

docs/reference/esql/functions/to_string.asciidoc Outdated Show resolved Hide resolved
@abdonpijpelink
Copy link
Contributor Author

Thank you for your thorough review @alex-spies ! I have applied all your suggestions, except those that involve missing type tables or aggregate functions. Those will be addressed in follow-up PRs.

@abdonpijpelink abdonpijpelink merged commit e87c49c into elastic:main Jan 25, 2024
15 checks passed
@abdonpijpelink abdonpijpelink deleted the docs-esql-more-functions-examples branch January 25, 2024 15:32
henningandersen pushed a commit to henningandersen/elasticsearch that referenced this pull request Jan 25, 2024
…04623)

* Functions E-Z

* Incorporate changes from elastic#103686

* More functions

* More functions

* Update docs/reference/esql/functions/floor.asciidoc

Co-authored-by: Liam Thompson <[email protected]>

* Update docs/reference/esql/functions/left.asciidoc

Co-authored-by: Liam Thompson <[email protected]>

* Apply suggestions from code review

Co-authored-by: Alexander Spies <[email protected]>

* Review feedback

* Fix geo_shape description

* Change 'colum'/'field' into 'expressions'

* Review feedback

* One more

---------

Co-authored-by: Liam Thompson <[email protected]>
Co-authored-by: Alexander Spies <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >docs General docs changes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants