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

Do not skip not available shard exception in search response #64337

Merged
merged 9 commits into from
Nov 24, 2020

Conversation

jimczi
Copy link
Contributor

@jimczi jimczi commented Oct 29, 2020

Today search responses do not report failures for shard that were not available
for the search.
So if one shard is not assigned on a search over 5 shards, the
search response will report:

"_shards": {
   "total": 5,
   "successful": 4,
   "skipped": 0,
   "failed": 0
}

If all shards are unassigned, we report a generic search phase exception with no cause.
It's easy to spot that successful is less than total in the response but not reporting
the failure is misleading for users.

This change removes the special handling of not available shards exception in search responses
and treat them as any other failure that could occur on a shard.
These exceptions will count in the failed section and will be reported in details in
the shard_failures section.

Closes #47700

 Today search responses do not report failures for shard that were not available
 for the search.
 So if one shard is not assigned on a search over 5 shards, the
 search response will report:

 ```
 "_shards": {
    "total": 5,
    "successful": 4,
    "skipped": 0,
    "failed": 0
}
```

If all shards are unassigned, we report a generic search phase exception with no cause.
It's easy to spot that `successful` is less than `total` in the response but not reporting
the failure is misleading for users.

This change removes the special handling of not available shards exception in search responses
and treat them as any other failure that could occur on a shard.
These exceptions will count in the `failed` section and will be reported in details in
the `shard_failures` section.
If all shards are unavailable, the search API will now return 404 NOT_FOUND as an indication
that the search failed because it couldn't find any of the resources.

Closes elastic#47700
@jimczi jimczi added >enhancement :Search/Search Search-related issues that do not fall into other categories :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. v8.0.0 v7.11.0 labels Oct 29, 2020
@elasticmachine
Copy link
Collaborator

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

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (:Distributed/Distributed)

@elasticmachine elasticmachine added Team:Distributed Meta label for distributed team Team:Search Meta label for search team labels Oct 29, 2020
Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jimczi for addressing this. Besides the comments below, I wonder if we should also add relevant shard-failures to the allowPartialSearchResults=false case in AbstractSearchAsyncAction.run?

I think we can also remove the discrepancy check in executeNextPhase?

@henningandersen
Copy link
Contributor

One more minor nit is the comment here.

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more comment.

@jimczi jimczi merged commit 6d22901 into elastic:master Nov 24, 2020
@jimczi jimczi deleted the not_available_shards_search branch November 24, 2020 07:49
jimczi added a commit that referenced this pull request Nov 24, 2020
Today search responses do not report failures for shard that were not available
 for the search.
 So if one shard is not assigned on a search over 5 shards, the
 search response will report:

 ```
 "_shards": {
    "total": 5,
    "successful": 4,
    "skipped": 0,
    "failed": 0
}
```

If all shards are unassigned, we report a generic search phase exception with no cause.
It's easy to spot that `successful` is less than `total` in the response but not reporting
the failure is misleading for users.

This change removes the special handling of not available shards exception in search responses
and treat them as any other failure that could occur on a shard.
These exceptions will count in the `failed` section and will be reported in details in
the `shard_failures` section.
If all shards are unavailable, the search API will now return 404 NOT_FOUND as an indication
that the search failed because it couldn't find any of the resources.

Closes #47700
@jakelandis jakelandis removed the v8.0.0 label Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. >enhancement :Search/Search Search-related issues that do not fall into other categories Team:Distributed Meta label for distributed team Team:Search Meta label for search team v7.11.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should we consider "Shard not available exception" as regular search failures
4 participants