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

[ES|QL] auto_bucket doesn't accept arg of type date #180061

Closed
drewdaemon opened this issue Apr 4, 2024 · 4 comments · Fixed by #180509
Closed

[ES|QL] auto_bucket doesn't accept arg of type date #180061

drewdaemon opened this issue Apr 4, 2024 · 4 comments · Fixed by #180509
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:ES|QL ES|QL related features in Kibana impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:ESQL ES|QL related features in Kibana

Comments

@drewdaemon
Copy link
Contributor

Kibana version:
8.14

Steps to reproduce:
Enter from kibana_sample_data_logs | eval bucket = auto_bucket(@timestamp, 24, "2023-10-23", NOW())

Expected behavior:
The editor should not complain about now().

Screenshots (if relevant):
Screenshot 2024-04-04 at 8 56 14 AM

@drewdaemon drewdaemon added bug Fixes for quality problems that affect the customer experience Team:ESQL ES|QL related features in Kibana labels Apr 4, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

@drewdaemon
Copy link
Contributor Author

Adding medium impact since this is in the getting started guide.

@drewdaemon drewdaemon added the impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. label Apr 4, 2024
@stratoula
Copy link
Contributor

Good choice, and auto bucket is going to be a popular one

@stratoula stratoula added the Feature:ES|QL ES|QL related features in Kibana label Apr 4, 2024
@drewdaemon
Copy link
Contributor Author

Some more problems...

We are only supporting date fields for the first parameter

Screenshot 2024-04-09 at 4 32 16 PM

We're suggesting fields and functions that accept fields for the 2-4th parameters. These arguments must all be constants.

Screenshot 2024-04-09 at 4 26 25 PM

When we start supporting the (number, number, number, number) signature, the validator complains about the first parameter when it should probably complain about subsequent parameters instead.

Screenshot 2024-04-09 at 4 35 09 PM

Some other weirdness too, but probably attributable to #179966 :(

@drewdaemon drewdaemon self-assigned this Apr 12, 2024
drewdaemon added a commit that referenced this issue Apr 16, 2024
## Summary

Close #180061

Key fixes
- `auto_bucket` 
- now just called `bucket` as of
elastic/elasticsearch#107197
  - now accepts dates for the 3rd and 4th parameters
  - now accepts a number field for the first parameter
- Constant-only parameters
- We no longer suggest fields or variables for `auto-bucket`'s 2nd, 3rd,
and 4th parameters, all of which must be constants
- Validator catches non-constants even if they are nested in layers of
functions (e.g. `auto_bucket(@timestamp, abs(length(bytes)), "", "")`)

Outstanding issues
- [x] Validation catches fields in a constant-only parameter spot, but
not if they are nested in a function
<img width="600" alt="Screenshot 2024-04-10 at 11 31 38 AM"
src="https://github.com/elastic/kibana/assets/315764/3b73419a-f9d1-4d59-a128-b0135eb50a90">

_Validator sees the problem_

<img width="600" alt="Screenshot 2024-04-10 at 11 31 14 AM"
src="https://github.com/elastic/kibana/assets/315764/1b5b0999-a697-4625-a8a3-15415054200b">

_Validator doesn't see the problem_

### Checklist

- [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

---------

Co-authored-by: Stratoula Kalafateli <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:ES|QL ES|QL related features in Kibana impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:ESQL ES|QL related features in Kibana
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants