src/platform/packages/shared/kbn-esql-language/README.md
The general idea of this package is to provide comprehensive ES|QL functionality including low-level parsing, building, traversal, pretty-printing, manipulation features on top of a custom compact AST representation, and advanced language features such as validation, autocomplete, hover, and signature help.
At the lowest level, the package provides a parser that converts ES|QL text into
an AST representation. Or, you can use the Builder class to construct the AST
manually:
parser — Contains text to ES|QL AST parsing codeast/builder — Contains the Builder class for AST node constructionThe Traversal API lets you walk the AST. The Walker class is simple
to use, while the mutate utilities provide more powerful manipulation capabilities:
ast/walker — Contains the ES|QL AST Walker utilityast/mutate — Contains code for traversing and mutating the ASTThe Pretty-printing API lets you format the AST to text:
Advanced ES|QL language features including editor support:
language — Validation, autocomplete, hover, and signature help
language/validation — ES|QL query validation logiclanguage/autocomplete — Autocomplete and suggestion serviceslanguage/hover — Hover information providerslanguage/signature_help — Function signature assistancelanguage/inline_suggestions — Inline suggestion featuresThe Commands registry allows you to register and manage ES|QL commands:
The Composer API provides a high-level, secure, and developer-friendly way to build ES|QL queries:
Much of the functionality of this package is demonstrated in the demo UI. You can run it in Storybook, using the following command:
yarn storybook esql_ast_inspector
Alternatively, you can start Kibana with Example Plugins enabled, using:
yarn start --run-examples
Then navigate to the ES|QL AST Inspector plugin in the Kibana UI.
In general when operating on changes here use the yarn kbn watch in a terminal
window to make sure changes are correctly compiled.