-
Notifications
You must be signed in to change notification settings - Fork 25.4k
[DOCS] Update ES|QL generated docs to consistently use the applies_to
metadata
#128576
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] Update ES|QL generated docs to consistently use the applies_to
metadata
#128576
Conversation
- Add PREVIEW annotations to all preview functions - Update docs generation logic to use annotations instead of preview boolean - Keep existing preview boolean for Kibana
Match.java: Updated the options parameter description MultiMatch.java: Updated the options parameter description ToLower.java: Reformatted parameter description and updated version annotation ToUpper.java: Removed the appliesTo annotation entirely and reformatted parameter description
…averner/elasticsearch into esql_docs_real_applies_to
Made this PR easier to review:
|
I just merged main in to pick up my changes. Looks like @leemthompo already did. but doesn't hut I guess. |
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.
Overall I think this is heading in the right direction and is an improvement, but I did see a number of preview items that seemed to be wrong. Also, I'm finding the use of preview confusing, sometimes with a version sometimes without, and the choice of version does not match any pattern I can discern.
::: | ||
```{applies_to} | ||
stack: preview 9.0.0 | ||
serverless: preview |
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.
Was the previous serverless:ga
incorrect?
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.
we will flip all the search functions GA for both in fast follow up 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.
++ to Craig - it'd be nicer if the Serverless: GA wasn't changed in this PR
Also applies to the other full text search functions.
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.
This technically doesn't change the serverless GA, because that note was only about optional named parameters.
The big :::{warning}Do not use on production environments.
banner means Match is currently still in preview in the docs
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.
It wasn't actually, the live docs still say tech preview currently
docs/reference/query-languages/esql/_snippets/functions/layout/multi_match.md
Show resolved
Hide resolved
docs/reference/query-languages/esql/_snippets/functions/layout/round_to.md
Show resolved
Hide resolved
docs/reference/query-languages/esql/_snippets/functions/layout/st_distance.md
Outdated
Show resolved
Hide resolved
@@ -3,5 +3,5 @@ | |||
**Parameters** | |||
|
|||
`str` | |||
: String expression. If `null`, the function returns `null`. The input can be a single- or multi-valued column or an expression. | |||
: String expression. If `null`, the function returns `null`. The input can be a single-valued column or expression, or a multi-valued column or expression {applies_to}`stack: ga 9.1.0`. |
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.
Definitely an area for improvement, but I guess this is the best we can get at the moment.
) } | ||
examples = { | ||
@Example(file = "string", tag = "to_lower"), | ||
@Example(file = "string", tag = "to_lower_mv", applies_to = "stack: ga 9.1.0") } |
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.
I like this approach. I think we could improve the rendering, but this is a good first step.
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.
docs eng will handle rendering for us :)
appliesTo = { | ||
@FunctionAppliesTo( | ||
lifeCycle = FunctionAppliesToLifecycle.COMING, | ||
version = "9.1.0", | ||
description = "Support for multivalued parameters is only available from 9.1.0" | ||
) } |
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.
Shouldn't it say serverless, so we know it is not in stateful?
.../esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3SupportTests.java
Show resolved
Hide resolved
###### DISCONTINUED 9.0.0 | ||
The ability to count the number of emojis in a string has been discontinued since 9.0.0 | ||
::: | ||
```{applies_to} |
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.
This test originally deliberately tried to test a complex example, and the new version is extremely simple. Perhaps we could think of a new complex example? At least where stack and serverless are both mentioned?
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.
💯 in a follow up 👍
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.
💯 — will follow up
@@ -418,7 +404,7 @@ public static class TestClass extends Function { | |||
@Example(description = """ | |||
To count the number of times an expression returns `TRUE` use a | |||
<<esql-where>> command | |||
to remove rows that shouldn’t be included""", file = "stats", tag = "count-where"), | |||
to remove rows that shouldn't be included""", file = "stats", tag = "count-where"), |
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.
This is wrong. We took the decision in March to put in the correct typesetting apostrophe because MD does not render it correctly, while asciidoc does. This appears to reverse that decision.
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.
unintended side effect, and unfortunately a lot less important than being able to GA the search functions for 9.1
- Revert CATEGORIZE back to GA (remove preview flags that were incorrectly added) - Revert spatial functions (ST_CONTAINS, ST_DISJOINT, ST_INTERSECTS, ST_WITHIN) back to GA - Revert match operator to show PREVIEW status correctly - Revert MatchOperator appliesTo annotation to PREVIEW lifecycle - Update TO_LOWER/TO_UPPER parameter descriptions for clarity
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.
Thanks for the iteration @leemthompo , much easier to review now.
I have some minor remarks, but please consider this unblocked and merge after handling my comments at your own discretion.
@@ -50,6 +52,7 @@ public class Term extends FullTextFunction implements PostAnalysisPlanVerificati | |||
@FunctionInfo( | |||
returnType = "boolean", | |||
preview = true, | |||
appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.PREVIEW, version = "9.0.0") }, |
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.
How do we make sure we don't forget to update this? To release into tech preview, the workflow right now is to link in the generated docs and move the function out of the snapshot-only list; seems like updating this annotation would be easy to forget.
In contrast, for TO_UNSIGNEDLONG
and most other tech preview functions, we just didn't provide a version.
...lugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java
Outdated
Show resolved
Hide resolved
...lugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java
Outdated
Show resolved
Hide resolved
version = "9.0.0", | ||
description = "The ability to count the number of emojis in a string has been discontinued since 9.0.0" | ||
) } | ||
appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.GA, version = "9.1.0") } |
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.
++ to what Craig said, it'd be great to make this example more complex again.
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.
Definitely, work for follow up
::: | ||
```{applies_to} | ||
stack: preview 9.0.0 | ||
serverless: preview |
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.
++ to Craig - it'd be nicer if the Serverless: GA wasn't changed in this PR
Also applies to the other full text search functions.
::: | ||
|
||
```{applies_to} | ||
stack: preview 9.0.0 |
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.
To connect to my comment on the functions java code, here, it's confusing that it says 9.0.0 rather than just "preview"; even though the 9.0.0 is not going to be rendered, I as a human am confused.
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.
@@ -2,7 +2,7 @@ | |||
"comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.", | |||
"type" : "scalar", | |||
"name" : "match", | |||
"description" : "Use `MATCH` to perform a match query on the specified field.\nUsing `MATCH` is equivalent to using the `match` query in the Elasticsearch Query DSL.\n\nMatch can be used on fields from the text family like text and semantic_text,\nas well as other field types like keyword, boolean, dates, and numeric types.\nWhen Match is used on a semantic_text field, it will perform a semantic query on the field.\n\nMatch can use function named parameters to specify additional options for the match query.\nAll match query parameters are supported.\n\nFor a simplified syntax, you can use the match operator `:` operator instead of `MATCH`.\n\n`MATCH` returns true if the provided query matches the row.", |
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.
Observation: we're slimming down the docs exported to Kibana here, it seems.
Also happened in match_phrase.json
.
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.
I think whoever did those docs squished everything into Description which is incorrect for the normal docs, but smells like a hack to get everything into Kibana docs without updating the docs gen code to pull in DetailedDescription
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.
will investigate in follow up
- added `stack: ga 9.1.0` blocks to match_phrase.md and qstr.md examples - simplified term.md version from `preview 9.0.0` to just `preview` - added `applies_to = "stack: ga 9.1.0"` to matchphrase and querystring java annotations - removed version `9.0.0` from term function annotation - deleted unused `makeCallout()` and `appendLifeCycleAndVersion()` methods
Pulled from elastic#128576 so it's easier to review.
Pulled from elastic#128576 so it's easier to review.
Pulled from elastic#128576 so it's easier to review.
…o` metadata (elastic#128576) - Add PREVIEW annotations to all preview functions - Update docs generation logic to use annotations instead of preview boolean * Changed stack: ga 9.1 to stack: coming in multiple places - Match.java: Updated the options parameter description - MultiMatch.java: Updated the options parameter description - ToLower.java: Reformatted parameter description and updated version annotation - ToUpper.java: Removed the appliesTo annotation entirely and reformatted parameter description - updated applies_to annotations to specify both preview 9.0.0 and ga 9.1.0 lifecycle stages - added version-specific documentation examples with applies_to markers for ga 9.1.0 features - enhanced to_lower and to_upper functions to indicate support for multi-valued expressions in ga 9.1.0 - added version guards around function parameters and descriptions using applies_to syntax - updated function parameter descriptions to indicate ga 9.1.0 availability for named parameters - use detailedDescription + and fix match_phrase applies_to syntax - strip inline applies_to from kibana docs - update roundto, matchphrase lifecycles - fix match named params info - various spatial functions are preview - unsigned long is preview - update qstr - Update TO_LOWER/TO_UPPER parameter descriptions for clarity - hide spatial functions per elastic#129839 - added `stack: ga 9.1.0` blocks to match_phrase.md and qstr.md examples - simplified term.md version from `preview 9.0.0` to just `preview` - added `applies_to = "stack: ga 9.1.0"` to matchphrase and querystring java annotations - removed version `9.0.0` from term function annotation - deleted unused `makeCallout()` and `appendLifeCycleAndVersion()` methods Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Liam Thompson <leemthompo@gmail.com> Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> Co-authored-by: Nik Everett <nik9000@gmail.com>
…o` metadata (elastic#128576) - Add PREVIEW annotations to all preview functions - Update docs generation logic to use annotations instead of preview boolean * Changed stack: ga 9.1 to stack: coming in multiple places - Match.java: Updated the options parameter description - MultiMatch.java: Updated the options parameter description - ToLower.java: Reformatted parameter description and updated version annotation - ToUpper.java: Removed the appliesTo annotation entirely and reformatted parameter description - updated applies_to annotations to specify both preview 9.0.0 and ga 9.1.0 lifecycle stages - added version-specific documentation examples with applies_to markers for ga 9.1.0 features - enhanced to_lower and to_upper functions to indicate support for multi-valued expressions in ga 9.1.0 - added version guards around function parameters and descriptions using applies_to syntax - updated function parameter descriptions to indicate ga 9.1.0 availability for named parameters - use detailedDescription + and fix match_phrase applies_to syntax - strip inline applies_to from kibana docs - update roundto, matchphrase lifecycles - fix match named params info - various spatial functions are preview - unsigned long is preview - update qstr - Update TO_LOWER/TO_UPPER parameter descriptions for clarity - hide spatial functions per elastic#129839 - added `stack: ga 9.1.0` blocks to match_phrase.md and qstr.md examples - simplified term.md version from `preview 9.0.0` to just `preview` - added `applies_to = "stack: ga 9.1.0"` to matchphrase and querystring java annotations - removed version `9.0.0` from term function annotation - deleted unused `makeCallout()` and `appendLifeCycleAndVersion()` methods Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Liam Thompson <leemthompo@gmail.com> Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> Co-authored-by: Nik Everett <nik9000@gmail.com>
…#130613) * [9.1] Fixes to null-predicates and lookup-join docs (#130440 #130410) (#130537) * Support types table in lookup join docs (#130410) * Support types table in lookup join docs * Don't show a results column in the join types * Make LOOKUP JOIN types table more compact * Update docs/reference/query-languages/esql/esql-lookup-join.md Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> Co-authored-by: Alexander Spies <alexander.spies@elastic.co> * Fix the ESQL docs for the null predicates (#130440) Fix null predicates docs * This also includes moving the note above the examples in the Kibana inline docs. * Add missing knn docs * Refine newlines in kibana docs --------- Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> Co-authored-by: Alexander Spies <alexander.spies@elastic.co> * Fix Null predicates after cherry-pick * [DOCS] Update ES|QL generated docs to consistently use the `applies_to` metadata (#128576) - Add PREVIEW annotations to all preview functions - Update docs generation logic to use annotations instead of preview boolean * Changed stack: ga 9.1 to stack: coming in multiple places - Match.java: Updated the options parameter description - MultiMatch.java: Updated the options parameter description - ToLower.java: Reformatted parameter description and updated version annotation - ToUpper.java: Removed the appliesTo annotation entirely and reformatted parameter description - updated applies_to annotations to specify both preview 9.0.0 and ga 9.1.0 lifecycle stages - added version-specific documentation examples with applies_to markers for ga 9.1.0 features - enhanced to_lower and to_upper functions to indicate support for multi-valued expressions in ga 9.1.0 - added version guards around function parameters and descriptions using applies_to syntax - updated function parameter descriptions to indicate ga 9.1.0 availability for named parameters - use detailedDescription + and fix match_phrase applies_to syntax - strip inline applies_to from kibana docs - update roundto, matchphrase lifecycles - fix match named params info - various spatial functions are preview - unsigned long is preview - update qstr - Update TO_LOWER/TO_UPPER parameter descriptions for clarity - hide spatial functions per #129839 - added `stack: ga 9.1.0` blocks to match_phrase.md and qstr.md examples - simplified term.md version from `preview 9.0.0` to just `preview` - added `applies_to = "stack: ga 9.1.0"` to matchphrase and querystring java annotations - removed version `9.0.0` from term function annotation - deleted unused `makeCallout()` and `appendLifeCycleAndVersion()` methods Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Liam Thompson <leemthompo@gmail.com> Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> Co-authored-by: Nik Everett <nik9000@gmail.com> * First round cleanup of docs after cherry-picking Includes partial support for the grammer fix to the header comment. * Second round, just replacing `no` with `not` * Fix lookupjointypes test after backport --------- Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> Co-authored-by: Alexander Spies <alexander.spies@elastic.co> Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Liam Thompson <leemthompo@gmail.com> Co-authored-by: Nik Everett <nik9000@gmail.com>
Summary
This PR updates the documentation generation system for ESQL functions to correctly generate
applies_to
metadata in DocsV3, namely to support multiple versions and lifecycles.This metadata is needed to signal version differentiation in the new docs, because we don't publish version-branched docs in 9.x (we don't duplicate every page for every minor).
For example, if something is preview in 9.0 and GA in 9.1 we need all this information on single, live 9.x page, that's what
applies_to
enables. Importantly, this also enables us to correctly signal serverless feature availability in the new docs.We need different levels of
applies_to
discrimination for this:Important
Once this PR is merged, we will use this new documentation generation logic to properly GA full-text search functions in a follow-up PR.
Key changes
1. Documentation generation code
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/Example.java
- Addedapplies_to()
field for version-specific examplesx-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java
- Updated to generate standardizedapplies_to
blocks instead of manual calloutsNote
DocsV3Support.java
contains the most significant docs gen code changes:2. Function status corrections
applies_to
syntaxST_*
): Added missingpreview = true
flags, and now use properapplies_to
syntax3. Generated documentation updates
As a result all of the function code adjusted results in updated markdown and Kibana JSON file updates
Result
The documentation system now correctly generates version-aware metadata, enabling proper lifecycle tracking across versions. All full-text search functions are consistently marked as technical preview with the correct
applies_to
syntax, to enable us flipping them to GA for 9.1.👀 URL preview