## Summary
Relates to https://github.com/elastic/elasticsearch/issues/109265
These test reflect the reality of how date casting is working in
Elasticsearch today. When the above issue is addressed in Elasticsearch,
these tests will fail the error sync check and prompt us to update the
validator.
---------
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
## Summary
Accepts null values for all function and operator arguments.
<img width="510" alt="Screenshot 2024-05-24 at 11 04 43 AM"
src="75ce23ed-ec91-404b-8c65-6f023fb71a57">
### 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 <efstratia.kalafateli@elastic.co>
## Summary
Resolve https://github.com/elastic/kibana/issues/179634
This PR introduces a script to gather metadata from Elasticsearch and
build the function definitions for Kibana's client-side validation.
To run the script: `cd packages/kbn-esql-validation-autocomplete && yarn
makedefs path/to/elasticsearch/repo`
## Current limitations
### Things we can't (yet) gather from ES
#### Things that are currently being filled in on the Kibana side but
would be missing if we had to rely completely on ES
- function aliases (e.g. `to_str`)
- operators and aggs (issues for Elasticsearch
https://github.com/elastic/elasticsearch/issues/107219 and
https://github.com/elastic/elasticsearch/issues/107220)
- Kibana AST parameter settings
- `constantOnly` — whether a parameter can be a non-literal or not
(`percentile`, `auto_bucket`)
- `constantOptions`/`constantSuggestions` — specific information about
which constants are accepted or suggested for particular parameters.
- `supportsWildcard` — whether a parameter can contain `*` (only `count`
at the moment)
- `noNestingFunctions` — whether a parameter can contain nested
functions (used for all agg functions)
- Kibana date constant types
- `chrono_literal`
- `time_literal`
### Other considerations
- Asciidoc links need to be scrubbed (e.g. `Function
{wikipedia}/foo/bar[arccosine] returns blah blah`)
- As of https://github.com/elastic/elasticsearch/pull/106454 some
descriptions reference outdated parameter names and some parameter names
are questionable:
<img width="600" alt="Screenshot 2024-03-28 at 1 07 16 PM"
src="3b9ab457-e9fd-4c5f-afb2-23ae769bb44a">
_parameter `n` is now called `number`, but the description still calls
it `n`... also, is `number` really the best name for the variable?_
### 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/packages/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
---------
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
Close https://github.com/elastic/kibana/issues/182390
### To test
You can test all aspects of the script by first making some changes to
`packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts`
- delete several tests from an existing function describe block ("block
1"—except don't choose "date_diff" since it has a bunch of custom tests)
- delete another function describe block completely ("block 2")
- change the expected result of several of the tests in a third function
describe block ("block 3")
Then, run `yarn maketests` from within
`packages/kbn-esql-validation-autocomplete`
**Expected result**
- Block 1 should have the deleted tests restored
- Block 2 should be restored entirely (though it may be moved in the
tests file)
- Block 3 should be untouched
### Checklist
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>