[8.19] [ES|QL] Editor extensions registry - recommended queries (#221474)#222509
Merged
kibanamachine merged 4 commits intoelastic:8.19from Jun 4, 2025
Merged
[8.19] [ES|QL] Editor extensions registry - recommended queries (#221474)#222509kibanamachine merged 4 commits intoelastic:8.19from
kibanamachine merged 4 commits intoelastic:8.19from
Conversation
) ## Summary Closes elastic#200026 ### Scope This PR is allowing the solutions teams to register extensions to the editor. The first extension is **the recommended queries**. I prefer to add extra extensions in follow up PRs mostly to keep it clean and also because I want to see the usage first. These extensions should not appear in the classic mode. They should appear only on the solution that they are being registered for. Some examples below: - Only static suggestions, for index without solution extensions <img width="913" alt="image" src="https://github.com/user-attachments/assets/7fad3b42-3e03-43a6-91e6-6166337536ca" /> - Additional suggestions, for index with solution extensions <img width="760" alt="image" src="https://github.com/user-attachments/assets/0988c9f4-8986-4d45-a064-a536c71a690e" /> ### Some more technical notes - I am creating a server side registry in the esql plugin. I considered to create a plugin from scratch but I decided against it as at this point is only esql related extensions and we are trying to keep our plugins number as low as possible. It can get moved to another plugin if we ever decide in favor of it. - Each solution can register in their plugins their extensions. I have added a Readme which I hope it helps but this is how it should look ``` const esqlExtensionsRegistry = esql.getExtensionsRegistry(); esqlExtensionsRegistry.setRecommendedQueries( [ { name: 'Logs count by log level', query: 'from logs* | STATS count(*) by log_level', }, { name: 'Apache logs counts', query: 'from logs-apache_error | STATS count(*)', }, { name: 'Another index, not logs', query: 'from movies | STATS count(*)', }, ], 'oblt' ); ``` - I preferred a server side registry for multiple reasons: - In the case we want to make it more advanced in the future (more checks, LLMs etc) it make more sense to have a server side solution - It is more performant to do some checks such as (does this source exist?) etc - It allows me to create a route to get these extensions. I am using this route to get the extensions to the editor but in the future we could use the same route to display these extensions in a flyout or wherever the solutions teams want ### Note This PR is not registering anything at the editor but just sets up the architecture. The registration of recommended queries should happen from the solutions teams in their plugins. ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 0bba089)
3 tasks
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
History
cc @stratoula |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.19:Questions ?
Please refer to the Backport tool documentation