-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ES|QL] Support _query versioning #179641
Comments
Pinging @elastic/kibana-esql (Team:ESQL) |
Can we know that there will always be a migration path? Renaming a command is one thing. What about if the ES team actually removes something without replacing the functionality? |
This is another case, a most dangerous one. I a adding this to the description. Thanx Drew |
We (at least in Analytics) usually use
In SOs we save this object too. What if we extend it with a version prop?
This way during a fetch we can always pass the saved If user edits the query, we can override the version with the current one regardless of what version was there before. In some cases users have to modify the query anyway to comply with the validation. For Kibana to know the latest supported version, we would need to introduce a new API to fetch it from ES, no? |
There are cases that the user might not want to overwrite:
Also it is very messy to have a dashboard with ES|QL panels of different versions. The ES|QL editor will always be in the latest version so it will complain for older versions (in case of syntax incompatible versions) At some point we need to make a decision of course, we can't be perfect for all cases but I hope that this version won't change very often
We are not thinking of fetching it from ES at some point but having a utility at kibana. We are still on discussions about this. |
I guess... we could version our validation engine... |
We could but how many versions of the parser / lexer are we going to support? 🤷♀️ But still, the editor is not a big problem, the worst thing it can happen is that the validator is going to complain. We can disable it for versions < latest so no problem at all |
Follow up here: We are going to have an api to retrieve the versions elastic/elasticsearch#107069 |
It seems to me that the root problem here is that our UI does not make the version explicit. All these problems exist for any ESQL API consumer but the ES team solved it by asking for an explicit version in the API request. If in the UI an ESQL query is always accompanied by a version then it would be safe for a user to copy a version 1 query from a lens and paste it into discover, because discover will know to interpret this as a v1 query. I'm not sure what's the best way to display this, but I can imagine something like a But this is really just a workaround for the fact that an ESQL query on it's own is not enough for Elasticsearch to give you a stable response, a query without a version is not a complete backwards compatible query. Why don't we expose the version directly in the query syntax:
The version could be optional and default to the latest version. So This has the added benefit of when you copy and paste a query from somewhere on the internet it will keep working even after a breaking query change because the version was explicit. Hopefully we'll never need a v2 for at least the next 10 years and everyone just happily writes unversioned queries forever. But in the unlikely event, we have an elegant way to introduce a breaking change without confusing users by hiding the version. |
We discussed this with the ES team but they want to make it mandatory. I don't think that this is very important tbh
I am not sure about the version being part of the query, this will mean that we are having a different lexer / parser from ES and we don't want this. The version being visible in the UI, yes absolutely. I have also suggested that. The migration can update the query or add the version in a property, agreed 👍 In case of the latter it would be really weird in a dashboard though. Are you going to have a mix of v1 and v2 charts? If the user wants to upgrade to v2? |
FWIW, I think we have to go with solution 1 that Stratoula proposed in order to provide a reasonable user experience - we need to be using the same version of ESQL across all of Kibana so user can use the same queries in different applications. |
I think the best UX is to always upgrade the queries for the user (migrations). However, I see a few downsides that make me lean towards exposing the version in the UI:
I'm a bit scared that if we commit to autoupgrade users' queries, we might be adding more headaches to ourselves. N.B.: If we decide not to auto-upgrade, we'll need to add a check in Upgrade Assistant to warn users when they upgrade to a version of the stack that no-longer supports their ES|QL version. Speaking of version upgrades... how would deprecated versions work in Serverless? Should we follow a "Google" approach? Send an email about a version being deleted in 6 months (maybe some additional reminders), and hope that the user will migrate in time? |
I agree that trying to automatically upgrade queries for users sounds like a big headache with potentially little reward if we don't expect to break their queries often. I'm not very close to current ES|QL work, but @jughosta's suggestion seems like it makes the most sense to me. If we store ES|QL queries in an object like I would think at the point when a user goes to edit an outdated query, we could show an indicator in the editor that their query is outdated and validation is disabled, with an option to update the editor to the latest version. This might cause syntax errors or behaviour changes for them, but I feel like that would be the case when trying to run outdated code in any language that introduced breaking changes. We could also link to or embed relevant documentation in the editor to help guide them. And if we really feel like some sort of automation is valuable, we could offer something like an in editor migration assistant to help update the query to the latest version (maybe an AI assistant that understands both ES|QL versions could help here?). Pasting code from outside sources would still be an issue since it would always try to run in the latest version in the editor, but this also feels like a situation you could run into with any language that has breaking changes. This approach becomes an issue when we try to programatically modify a user provided query, but then maybe it's on us to version our utilities that do this for compatibility. |
## Summary Due to #179641 ES is going to add a mandatory field `version`. (it is optional for now but they want to make it required for the GA). The version will change in backwards incompatible changes: - syntax changes - functions / commands output changes This is the first PR which is adding the first version manually for now. In #179641 we are exploring how to deal with versioning in kibana. We are going to offer a solution in 8.15. For now we are adding the version hardcoded (otherwise when the field is marked required kibana _query requests will fail. 👮♀️ If you are aware of any other application which uses the _query api and is not updated in this PR please let me know --------- Co-authored-by: kibanamachine <[email protected]>
Update: The version has been hardcoded everywhere in kibana we are using the _query api #180248 |
thank you all for your feedback so far. I can see that some of you prefer my bullet 1 and others the bullet 2, which indicates the complexity of this problem. I am writing a document which explains better each path forward with the cons and the pros but @davismcphee about the bullet 2 which is what you are also suggesting. It is definitely the solution where you don't introduce breaking changes to the customer or you don't run migrations but it comes with great UI complexity for all the apps that want to save ES|QL related SOs. I will give some examples of the things we need to take care:
|
We decided to go with the simplest solution which means that we will use the same version in kibana everywhere. We want kibana to follow ES and we want to have the same version everywhere. ES is not going to introduce breaking changes often and they will try their best to have compatible queries along different versions. The philosophy is: We will do our best to not create breaking changes to the users. So far all the consumers of the _query are sharing the same version thanks to a reusable constant introduced in 8.14. We could improve the consumers' experience by providing easy tools to run their queries. So far we have:
We could:
The only dependency is the core plugin which is an essential dependency for all plugins and nothing more.
|
## Summary Adds a new utility for the users who want to retrieve the columns from a query without expressions but using the search strategy. This is the first utility to add for fetching ES|QL data without expressions. This is only for columns but we can extend for fetching the entire table instead. The latter will be part of #179641 (comment) --------- Co-authored-by: kibanamachine <[email protected]>
We decided to remove the I will proceed with removing the version across kibana |
## Summary Part of #179641 Adds another run query helper based on the search strategy in our esql-utils package.
Describe the feature:
To support backwards compatibility, the ES team is going to add mandatory ES|QL version in the _query api. This version is not going to change very often, it is going to change only when a breaking change is being introduced (for example a command changes from
comA
tocomB
but not when a new command is being introduced.The changes are mostly:
This complicates things for kibana for multiple reasons:
from logs | keep field1
and thekeep
changes toproject
? If the editor is in version 2, then the query will appear as invalid. The latter won't be very common but can happenSolutions
Note
With the
version: snapshot
we can test the unreleased latest versionThe text was updated successfully, but these errors were encountered: