-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
scan_type is search & small result set gives SearchContextMissingException #5345
Comments
This bug may be false but there is an underlying problem that might cause me to see this that I discovered doing some more analysis on this: I had a bit of code that used search_type that worked fine with 0.90 but broke when I tried it with 1.0.1 (upgraded this afternoon) today in several ways: problem #1: the exit condition changed. I used to parse the scrollId from the response and stop fetching new results when it was no longer included. Now I get the following response for the final page of results: {
} So it is actually reporting an error for the next page of results from one of the shards and includes the final results. This looks weird to me. The only way I have of deducing that this is the final page is to look at the failures object or to keep track of the number hits I've processed. That can't be right. problem #2: the size parameter seems to work in a weird way. I'm not actually sure if that is a change or whether this was always broken. In any case, this seems to be per shard. So if I specify size=100, I actually get back 500 results per page, which would be the number of shards times the size. So getting back to my original bug, I probably am getting the results but my code fails trying to fetch another page of results because of the broken exit condition. I would expect either the old behavior where the last result fetched no longer includes the scrollid. Alternatively, the API could be improved by explicitly including a next url and omitting that on the last page. My interpretation of the old behavior was to use the scrollid like this indeed. In any case, asking for the last page should not return any errors from any shard. |
actually looking closer it turns out it was a pilot error after all. I was passing in the same scrollid instead of using the one in the request. The minor issue of the pageSize above may be valid but that's explainable and probably not a big issue. So, closing this one. |
@jillesvangurp to explain: with the |
may be duplicate of or related to #5170
using elasticsearch 1.0.0
I have a query where I would like to use search_type=scan to scroll through all contacts owned by a user. It works fine if the user has enough contacts but I have one user where there are only two contacts and this fails.
So I do a GET on
http://localhost:9200/users/contact/_search?search_type=scan&scroll=60m&size=100
{
"query": {
"term": {
"userId": {
"value": "1o"
}
}
}
}
I get back the following response
{
"_scroll_id":"c2Nhbjs1OzIwMTpxS1hwWW80MFJvV0hwbjdBcm5JRkF3OzIwNDpxS1hwWW80MFJvV0hwbjdBcm5JRkF3OzIwMzpxS1hwWW80MFJvV0hwbjdBcm5JRkF3OzIwMjpxS1hwWW80MFJvV0hwbjdBcm5JRkF3OzIwNTpxS1hwWW80MFJvV0hwbjdBcm5JRkF3OzE7dG90YWxfaGl0czoyOw==",
"took":1,
"timed_out":false,
"_shards":{
"total":5,
"successful":5,
"failed":0
},
"hits":{
"total":2,
"max_score":0.0,
"hits":[
}
and then http://localhost:9200/_search/scroll?scroll=60m
c2Nhbjs1OzIwMTpxS1hwWW80MFJvV0hwbjdBcm5JRkF3OzIwNDpxS1hwWW80MFJvV0hwbjdBcm5JRkF3OzIwMzpxS1hwWW80MFJvV0hwbjdBcm5JRkF3OzIwMjpxS1hwWW80MFJvV0hwbjdBcm5JRkF3OzIwNTpxS1hwWW80MFJvV0hwbjdBcm5JRkF3OzE7dG90YWxfaGl0czoyOw==
fails with a SearchContextMissingException
The same query for a user with 30000 contacts works fine and pages through the results like I would expect. The above query returns the two results normally if I query without search_type=scan
So it only fails if the result set is smaller than the page size
The text was updated successfully, but these errors were encountered: