Commit graph

6 commits

Author SHA1 Message Date
Stratoula Kalafateli
72eea169d7
Revert "[ES|QL] Remove version from _query requests (#184053)" (#184244)
This reverts commit 5c78c01321.

## Summary

Reverts the https://github.com/elastic/kibana/pull/184053 as we don't
want to land in serverless before ES PR does.
2024-05-24 19:51:05 +02:00
Stratoula Kalafateli
5c78c01321
[ES|QL] Remove version from _query requests (#184053)
## Summary

Removes the versioning from the _query api requests.

This ES PR removes the version from the _query requests
https://github.com/elastic/elasticsearch/pull/108919 and got backported
at 8.14 too. We need to also remove it from our side too to be in sync
with ES changes.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-05-24 15:44:52 +02:00
Drew Tate
bec1755030
[ES|QL] Add more functions to the validator (#180640)
## Summary

- [x]
[`SIGNUM`](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-functions-operators.html#esql-signum)
- [x] spatial functions
- [x]
[`ST_CENTROID_AGG`](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-functions-operators.html#esql-agg-st-centroid)
- [x]
[`ST_CONTAINS`](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-functions-operators.html#esql-st_contains)
- [x]
[`ST_DISJOINT`](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-functions-operators.html#esql-st_disjoint)
- [x]
[`ST_INTERSECTS`](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-functions-operators.html#esql-st_intersects)
- [x]
[`ST_WITHIN`](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-functions-operators.html#esql-st_within)
- [x]
[`ST_X`](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-functions-operators.html#esql-st_x)
- [x]
[`ST_Y`](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-functions-operators.html#esql-st_y)
- [x]
[`MV_SLICE`](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-functions-operators.html#esql-mv_slice)
- [x]
[`MV_ZIP`](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-functions-operators.html#esql-mv_zip)

### 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
2024-04-13 08:54:45 +02:00
Stratoula Kalafateli
125c8951e5
[ES|QL] Runs the _query requests with the version (#180248)
## Summary

Due to https://github.com/elastic/kibana/issues/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 https://github.com/elastic/kibana/issues/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 <42973632+kibanamachine@users.noreply.github.com>
2024-04-09 17:39:08 +02:00
Marco Liberati
fb19e57a4e
[ES|QL] New @kbn/esql-services package (#179029)
## Summary

Closes https://github.com/elastic/kibana/issues/172649

This PR extracts the ES|QL service like "validation", "autocomplete",
"code_action" (quick fixes) and some other services into a separate
package `@kbn/esql-validation-autocomplete` which has no tie with Monaco
editor anymore.

All the AST and grammar logic has been encapsulated into a single
`@kbn/esql-ast` package who contains the `getAst` function together with
the `parser` and `lexer`.

## Validation enhancements

The validation API has been enhanced to gracefully degrade whenever
callbacks are not provided, via the `ignoreOnMissingCallback` option.
Tests are included as well for this scenario.

### Example plugin

An example plugin app has been developed to show to to use the
validation API

<img width="500" alt="Screenshot 2024-03-22 at 17 45 38"
src="ebc172d3-ee61-4f3a-9e42-dcb9b15c7e69">

The app starts with a missing callback:

<img width="855" alt="Screenshot 2024-03-22 at 17 36 22"
src="c9b81370-8a10-487d-b22f-2359e1365a54">

Toggling the ignore option will hide the index error due to the lack of
`getSources` callback:

<img width="816" alt="Screenshot 2024-03-22 at 17 28 17"
src="931f4e5f-3ad6-46f7-97ca-63d7bb66646b">

Warnings are shown as well when detected:

<img width="807" alt="Screenshot 2024-03-22 at 17 35 56"
src="5e3e0537-cba2-475f-946b-0302867384ca">

#### Code snippet

The example app produces a copyable code snippet of the current
configuration of the validator:

![Code
snippet](https://private-user-images.githubusercontent.com/924948/316838987-fd16da58-8790-40b2-851d-b92aca1811dc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE0NTY0MzUsIm5iZiI6MTcxMTQ1NjEzNSwicGF0aCI6Ii85MjQ5NDgvMzE2ODM4OTg3LWZkMTZkYTU4LTg3OTAtNDBiMi04NTFkLWI5MmFjYTE4MTFkYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwMzI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDMyNlQxMjI4NTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00ZDhhOGRlMjZjMzZhN2NjNTdkYWMxYTNjOWVkNTA3NDk5NGViOTg2NWEzMTAyZGM4MGYyOTQ0YjQ2N2Q3ZDI1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.H-3r_B57NK1-rS8UbR_bxlNtAMQ0flFGtW0oTIiOlr0)

### 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: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-03-27 14:39:48 +01:00
Marco Liberati
392bb4024e
[ES|QL] Integration tests (#177017)
## Summary

The validation test suite now dumps all test cases into a JSON with a
flag that tell if the query should fail or not.

On top of that an integration test has been written, who collects the
JSON and execute it again against the ES ES|QL `_query` endpoint, then
compare the two result.

* if both results are the same (both pass or errors) then it's good to
go 
* if client side fails and ES pass, then it's a failure  
* if client side passes and ES fails, then it's bad but still ok ⚠️ 
* in this case the error is logged and stored into a JSON (not
committed)

All tests are ran 8 times ( stringField => `["text", "keyword"]`,
numberField => `["integer", "double", "long", "unsigned_long]` for a
totale of ~16k assertions (2000 x 8 tests).
Assertions have to be within a single test to avoid memory issues on the
CI otherwise.

~~Fixes the signature utility for functions with a minimum number of
args.~~



### 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: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-02-19 12:07:55 +01:00