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

Missing scroll id now returns 404 #6040

Merged
merged 1 commit into from May 5, 2014

Conversation

spinscale
Copy link
Contributor

A bad/non-existing scroll ID used to return a 200, however a 404 might be more useful.
Also, this PR returns the right Exception (SearchContextMissingException) in the Java API.

TODO: I need some more feedback for this PR. I think this solution is not optimal and there might be a better option (checking the exception type twice is not what I want to do, I do this in order to return a real exception instead of a shard failure, but it is not a good solution codewise and I think there are better solutions which I do not see at the moment).

Closes #5729

@kimchy
Copy link
Member

kimchy commented May 5, 2014

looks good, one comment:

Won't calling SearchResponse#status will just return the correct HTTP code in this case? No need for specific handling of the status code?

Saying that, we have a bug in RestSearchAction where we don't use SearchResponse#status to use as the status code we return now (this is because of the REST refactoring that was done), can you fix that as well since its the same listener logic and can be shared.

Wondering if we can add a ToXContent extension interface, that can also return the relevant status code, and then the SearchResponse can implement it, and in RestToXContentListener we can the status from the response if its an instance of that "StatusToXContent" interface.

@kimchy
Copy link
Member

kimchy commented May 5, 2014

LGTM

A bad/non-existing scroll ID used to return a 200, however a 404 might be more useful.
Also, this PR returns the right Exception (SearchContextMissingException) in the Java API.

Additionally: Added StatusToXContent interface and RestStatusToXContentListener listener, so
the appropriate RestStatus can be returned

Closes elastic#5729
@spinscale spinscale merged commit d356881 into elastic:master May 5, 2014
kimchy added a commit to kimchy/elasticsearch that referenced this pull request May 6, 2014
This relates to elastic#6040, the fix is twofold, first, not handling missing context specifically in the search code, but behave the same as we do in non scroll search, where if all the shards failed, raise an exception. The second is to apply this logic in both scroll cases.
kimchy added a commit that referenced this pull request May 6, 2014
This relates to #6040, the fix is twofold, first, not handling missing context specifically in the search code, but behave the same as we do in non scroll search, where if all the shards failed, raise an exception. The second is to apply this logic in both scroll cases.
kimchy added a commit that referenced this pull request May 6, 2014
This relates to #6040, the fix is twofold, first, not handling missing context specifically in the search code, but behave the same as we do in non scroll search, where if all the shards failed, raise an exception. The second is to apply this logic in both scroll cases.
@clintongormley clintongormley added v2.0.0-beta1 >bug v1.2.0 :Search/Search Search-related issues that do not fall into other categories labels Jun 7, 2015
@clintongormley clintongormley changed the title [REST] Missing scroll id now returns 404 Missing scroll id now returns 404 Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories v1.2.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing scroll ID no longer returns exception
3 participants