[ES|QL] Autocomplete for STATS...WHERE#216379
Conversation
|
Pinging @elastic/kibana-esql (Team:ESQL) |
| /** | ||
| * @todo re-enable when expression autocomplete is officially supported for STATS ... BY | ||
| */ | ||
| // await assertSuggestions('from a | stats avg(b) by integerField % /', [ |
There was a problem hiding this comment.
Why these tests are commented out? Our changes should not affect them
There was a problem hiding this comment.
When we detected an operator in STATS we were sending the code to getFunctionArgsSuggestions which worked in this case. So it was kind of a half-hearted attempt to support expressions in the STATS <here>.
I removed that logic from getAstContext because it was sending us to the wrong place in the STATS ... WHERE <here>.
At the time, I was thinking I would add first-class expressions support for this case too, but that is for later in #216492.
I should be able to adjust the getAstContext logic to restore the original behavior without ruining the work done for STATS... WHERE.
| test('suggests `??function` option', async () => { | ||
| const { suggest } = await setup(); | ||
|
|
||
| test('suggests `?function` option', async () => { |
There was a problem hiding this comment.
Why did you change the test here? It should suggest ??function
There was a problem hiding this comment.
I didn't... maybe a merge thing. Will clean it up
| test('suggests `??field` option', async () => { | ||
| const { suggest } = await setup(); | ||
|
|
||
| test('suggests `?field` option', async () => { |
There was a problem hiding this comment.
Same here
| test('suggests `?field` option', async () => { | |
| test('suggests `??field` option', async () => { |
|
|
||
| /** | ||
| * Encapsulates handling of the "is null" and "is not null" | ||
| * checks... |
There was a problem hiding this comment.
Nope. That's all I have to say 🤣
There was a problem hiding this comment.
(I can expand a bit)
| // command ... "<here>" | ||
| return { type: 'value' as const, command, node, option, containingFunction }; | ||
| } | ||
| // /** |
There was a problem hiding this comment.
Why is this commented out?
There was a problem hiding this comment.
leftover, will remove
|
Some observations about the bug
I'll dig a bit more. If the fix is simple, I can pull it into this PR. |
|
Fixed in f03e5b6 |
stratoula
left a comment
There was a problem hiding this comment.
Awesome, thanx for fixing the bug in this PR too 🙌
💔 Build Failed
Failed CI StepsTest Failures
Metrics [docs]Page load bundle
History
|
|
Starting backport for target branches: 8.x |
## Summary Resolve elastic#209359 (No match operator or full-text search functions) ### Checklist - [x] 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) - [x] [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 (cherry picked from commit 2fda88c)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [[ES|QL] Autocomplete for `STATS...WHERE` (#216379)](#216379) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Drew Tate","email":"drew.tate@elastic.co"},"sourceCommit":{"committedDate":"2025-04-02T19:37:49Z","message":"[ES|QL] Autocomplete for `STATS...WHERE` (#216379)\n\n## Summary\n\nResolve https://github.com/elastic/kibana/issues/209359\n\n(No match operator or full-text search functions)\n\n### Checklist\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"2fda88c1660336baca61bec8a582a7f399b9d0ea","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Feature:ES|QL","Team:ESQL","backport:version","v9.1.0","v8.19.0"],"title":"[ES|QL] Autocomplete for `STATS...WHERE`","number":216379,"url":"https://github.com/elastic/kibana/pull/216379","mergeCommit":{"message":"[ES|QL] Autocomplete for `STATS...WHERE` (#216379)\n\n## Summary\n\nResolve https://github.com/elastic/kibana/issues/209359\n\n(No match operator or full-text search functions)\n\n### Checklist\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"2fda88c1660336baca61bec8a582a7f399b9d0ea"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216379","number":216379,"mergeCommit":{"message":"[ES|QL] Autocomplete for `STATS...WHERE` (#216379)\n\n## Summary\n\nResolve https://github.com/elastic/kibana/issues/209359\n\n(No match operator or full-text search functions)\n\n### Checklist\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"2fda88c1660336baca61bec8a582a7f399b9d0ea"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Drew Tate <drew.tate@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>



Summary
Resolve #209359
(No match operator or full-text search functions)
Checklist