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

ESQL autogenerate docs v3 #124312

Merged
merged 45 commits into from
Mar 13, 2025

Conversation

craigtaverner
Copy link
Contributor

@craigtaverner craigtaverner commented Mar 7, 2025

Building on the work started in #123904, we now want to auto-generate most of the small subfiles from the ES|QL functions unit tests.

This work also investigates any remaining discrepancies between the original asciidoc version and the new markdown, and tries to minimize differences so the docs do not look too different.

The kibana json and markdown files are moved to a new location, and the operator docs are a little more generated than before (although still largely manual).

Tasks remaining:

  • General asciidoc -> markdown conversion support
    • gradle task to find new files and copy to new locations
    • Fix apostrophes
    • Fix asciidoc links
    • Fix macros
    • Fix table syntax
    • Load examples in unit tests
    • Support inline examples in detailed description
    • more?
  • Generate functions docs
    • Generate functions/description
    • Generate functions/parameters
    • Generate functions/functionNamedParameters
    • Generate functions/types
    • Generate functions/layout
    • Generate functions/examples
  • Generate operators docs
  • Generate Kibana docs and json specs
  • Re-review differences between new 9.1 docs and latest 8.x docs
  • Add applies_to for appropriate features (difference between 9.1 and 9.0)
  • Delete temporary files *-new.md, *-orig.md and intermediate functions/*md, etc.

* More links fixed (support more automatic conversion of asciidoc links to markdown)
* Apostrophes manually fixed (used ot be done by asciidoc, but not now by MD)
* New TERMS function added with hidden docs
* More standard use of back-ticks for code in docs
@craigtaverner craigtaverner added >docs General docs changes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) :Analytics/ES|QL AKA ESQL labels Mar 7, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added Team:Docs Meta label for docs team v9.1.0 labels Mar 7, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@craigtaverner craigtaverner force-pushed the esql_autogenerate_docs_v3 branch from ac2cd7b to f95947c Compare March 7, 2025 12:33
The reformatting broken more than it fixed.
@craigtaverner craigtaverner changed the title ESQL utogenerate docs v3 ESQL autogenerate docs v3 Mar 7, 2025
@leemthompo leemthompo added auto-backport Automatically create backport pull requests when merged v9.0.0 labels Mar 7, 2025
@craigtaverner craigtaverner requested a review from ivancea March 10, 2025 20:06
Copy link
Contributor

@ivancea ivancea left a comment

Choose a reason for hiding this comment

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

Looks good!

There's a comment around the apostrophes formatting that I think could be some kind of misformatting 👀

Copy link
Contributor

Choose a reason for hiding this comment

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

As it's not detected as a rename, I suppose we'll keep both for now, right? (The Kibana files) And remove the old later. Or did we remove them already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I follow. I only see one abs.json file.

@@ -12,7 +12,7 @@
* <h2>Guide to adding new aggregate function</h2>
* <ol>
* <li>
* Aggregation functions are more complex than scalar functions, so it's a good idea to discuss
* Aggregation functions are more complex than scalar functions, so its a good idea to discuss
Copy link
Contributor

Choose a reason for hiding this comment

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

Are those apostrophe changes intended? I've seen them changed in some functions too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was very intentional, and quite a lot of work too.

The older asciidoc system converted these when publishing HTML, while the new MD system does not, so we need to do the conversion ourselves, manually. Most text editors also auto-convert these when you type, so any documentation written using editors will have the correct apostrophe character, but documentation generated from Java code will not (java editors do not auto-convert single-quotes to apostrophes when used in text).

@@ -210,7 +154,7 @@ protected static List<TestCaseSupplier> anyNullIsNull(
*
* Also, if this was the first time we saw the signature we copy it
* *again*, replacing the argument with null, but annotating the
* argument's type as `null` explicitly.
* arguments type as `null` explicitly.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here; it looks like some auto-formatting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As before, it was me doing manual reformatting because the auto-formatting was no longer working.

Comment on lines +132 to +146
knownFiles = Map.ofEntries(
entry("esql-commands", "esql/esql-commands.md"),
entry("esql-enrich-data", "esql/esql-enrich-data.md"),
entry("esql-examples", "esql/esql-examples.md"),
entry("esql-functions-operators", "esql/esql-functions-operators.md"),
entry("esql-implicit-casting", "esql/esql-implicit-casting.md"),
entry("esql-metadata-fields", "esql/esql-metadata-fields.md"),
entry("esql-multivalued-fields", "esql/esql-multivalued-fields.md"),
entry("esql-process-data-with-dissect-grok", "esql/esql-process-data-with-dissect-grok.md"),
entry("esql-syntax", "esql/esql-syntax.md"),
entry("esql-time-spans", "esql/esql-time-spans.md"),
entry("esql-limitations", "esql/limitations.md"),
entry("esql-function-named-params", "esql/esql-syntax.md"),
entry("query-dsl-query-string-query", "query-dsl-query-string-query.md")
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine for now, but I would reevaluate migrating those in the annotations.
Otherwise it's harder to know how to make a new link, as you have to find this logic here.
Depending on how many usages are of such links, and how longer they really get, it may not be that terrible (?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but it is kind-of a line in the sand. I took an approach that seemed to achieve two things:

  • Minimize my work (and therefor hopefully others)
  • Keep the annotation text clean and readible
  • Make backporting easier (fewer conflicts in the java code that have these annotations)

But it is true that it is less clear now how to create links. I think we should keep this approach for now, but re-evaluate this going forward. I see two directions:

  • We pick and publish a standard limited set of short-links for convenience, make sure everyone knows about them, and re-format the rest
  • We move to the new formatting entirely, removing all these short links

@craigtaverner craigtaverner merged commit d5ddb90 into elastic:main Mar 13, 2025
16 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.0 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 124312

jfreden pushed a commit to jfreden/elasticsearch that referenced this pull request Mar 13, 2025
Building on the work started in elastic#123904, we now want to auto-generate most of the small subfiles from the ES|QL functions unit tests.

This work also investigates any remaining discrepancies between the original asciidoc version and the new markdown, and tries to minimize differences so the docs do not look too different.

The kibana json and markdown files are moved to a new location, and the operator docs are a little more generated than before (although still largely manual).
craigtaverner added a commit to craigtaverner/elasticsearch that referenced this pull request Mar 13, 2025
Building on the work started in elastic#123904, we now want to auto-generate most of the small subfiles from the ES|QL functions unit tests.

This work also investigates any remaining discrepancies between the original asciidoc version and the new markdown, and tries to minimize differences so the docs do not look too different.

The kibana json and markdown files are moved to a new location, and the operator docs are a little more generated than before (although still largely manual).
elasticsearchmachine pushed a commit that referenced this pull request Mar 13, 2025
stratoula added a commit to elastic/kibana that referenced this pull request Mar 14, 2025
… ES (#214321)

## Summary

Based on the changes here
elastic/elasticsearch#124312 changes the paths
of the ES docs and definitions
clintandrewhall pushed a commit to clintandrewhall/kibana that referenced this pull request Mar 20, 2025
… ES (elastic#214321)

## Summary

Based on the changes here
elastic/elasticsearch#124312 changes the paths
of the ES docs and definitions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged backport pending >docs General docs changes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team v9.0.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants