-
Notifications
You must be signed in to change notification settings - Fork 974
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
SearchResponseIterator is scrolling the first page twice #595
Comments
Same for me: |
Thanks for investigating! Want to open a PR to fix the bug? If not, I'll try to get to it later this week or early next. I suspect this is due to how scrolling has changed over time (used to operate differently with scan/scroll). The helpers were contributed by community members and don't get as much testing (not a good excuse, just the truth). |
I don't remember how did I make WA in June, but it was working for me. And now it's still scrolling twice. (maybe I was changed some library versions or PHP... @polyfractal , did you manage to check this? P.S. what's mean PR? |
SearchResponseIterator is scrolling the first page twice
Hello,
When you use the SearchResponseIterator in a foreach, the first page is returned twice.
The reason seems to be in SearchResponseIterator::next().
Why does not the first iteration make call to the scroll api?
The iterator sequence is :
rewind() -> valid() -> current() -> key() -> next() -> valid() -> current() -> key() -> next() -> etc until valid returns false.
So at the first iteration, we have to move the cursor on the next page.
If I remove the if, it works well.
Code snippet of problem
Here is an how-to-reproduce example :
System details
Ubuntu 16.04.2 LTS
PHP 7.1.4 & PHP 5.6.30
ES 5.2.2
PHP-ES v5.2.0
The text was updated successfully, but these errors were encountered: