-
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
Improve error message for index exclusions when multi-target syntax is used for index exclusion #97866
Improve error message for index exclusions when multi-target syntax is used for index exclusion #97866
Conversation
Pinging @elastic/es-search (Team:Search) |
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.
LGTM
// the caller should have put "GET test*,-test3" | ||
infe = new IndexNotFoundException( | ||
"if you intended to exclude this index, ensure that you use wildcards that include it before explicitly excluding it", | ||
indexExpressions[0] |
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.
can you a quick unit test for this?
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.
Fixed. Sorry for the oversight.
…s used for index exclusion An index can be excluded after using a wildcard that includes it, such as GET test*,-test3/_search But if a wildcard is not used, it throws an exception: GET test1,test2,-test3/_search "type": "index_not_found_exception", "reason": "no such index [-test3]" This commit changes the error message in this case to say: "type": "index_not_found_exception", "reason": "no such index [-test3] and if you intended to exclude this index, ensure that you use wildcards that include it before explicitly excluding it"
9a11b11
to
475a6f0
Compare
An index can be excluded after using a wildcard that includes it, such as
GET test*,-test3/_search
But if a wildcard is not used, it throws an exception. For example
GET test1,test2,-test3/_search
results in:This commit changes the error message in this case to say:
This error message also more closely matches a similar error when trying to exclude a cluster in a
cross-cluster search: #97865