[ES|QL] accept negated index patterns (#184528)

## Summary

`*, -.*` is now acceptable.


### 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>
This commit is contained in:
Drew Tate 2024-05-31 09:20:17 -06:00 committed by GitHub
parent 4eb175f384
commit 4e8876d6a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 1 deletions

View file

@ -521,7 +521,7 @@ export function columnExists(
}
export function sourceExists(index: string, sources: Set<string>) {
if (sources.has(index)) {
if (sources.has(index) || index.startsWith('-')) {
return true;
}
return Boolean(fuzzySearch(index, sources.keys()));

View file

@ -430,6 +430,11 @@
"error": [],
"warning": []
},
{
"query": "from *,-.*",
"error": [],
"warning": []
},
{
"query": "from indexes*",
"error": [

View file

@ -352,6 +352,7 @@ describe('validation logic', () => {
testErrorsAndWarnings(`from *ex*`, []);
testErrorsAndWarnings(`from in*ex`, []);
testErrorsAndWarnings(`from ind*ex`, []);
testErrorsAndWarnings(`from *,-.*`, []);
testErrorsAndWarnings(`from indexes*`, ['Unknown index [indexes*]']);
testErrorsAndWarnings(`from remote-*:indexes*`, []);