-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Add index name validation rule for empty index names #119960
Add index name validation rule for empty index names #119960
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
…/elasticsearch into validate_empty_index_names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @craigtaverner, LGTM!
There are two types of index patterns, *-
and -
, that I can think of which can cause this error, and both of them are addressed in this PR. If we can have someone who is familiar with MetadataCreateIndexService.validateIndexOrAliasName
to double check that will be great. I couldn't think of a reason that we should not make this change.
An alternative is to skip the call to MetadataCreateIndexService.validateIndexOrAliasName
in IdentifierBuilder.validateIndexPattern
if it is an empty index pattern, just in case it is not preferable to change MetadataCreateIndexService.validateIndexOrAliasName
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - LGTM
💚 Backport successful
|
* Add index name validation rule for empty index names * Created negative tests for ES|QL index names with only exclusion character * Added test for `*-`
* Add index name validation rule for empty index names * Created negative tests for ES|QL index names with only exclusion character * Added test for `*-`
In serverless there was a suppressed REST error with the following stacktrace:
Without knowing the original query, it is hard to know how this happened, but the underlying exception is being thrown because the index name being identified in the ES|QL parser is empty. The current index name validation rules do not consider this case, so we get a StringIndexOutOfBoundsException, but we can enhance the validation rules to at least throw the correct exception, in this case InvalidIndexNameException.