Skip to content
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

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

quux00
Copy link
Contributor

@quux00 quux00 commented Jul 21, 2023

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:

"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"

This error message also more closely matches a similar error when trying to exclude a cluster in a
cross-cluster search: #97865

@quux00 quux00 added >non-issue :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team labels Jul 24, 2023
@quux00 quux00 marked this pull request as ready for review July 24, 2023 20:58
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

Copy link
Member

@javanna javanna left a 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]
Copy link
Member

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?

Copy link
Contributor Author

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.

quux00 added 3 commits July 25, 2023 16:20
…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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants