Skip to content

Commit

Permalink
fix SearchResponseIterator scroll first page twice (elastic#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
safecat committed Mar 29, 2019
1 parent d3c5b55 commit 37da9d5
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Elasticsearch/Helper/Iterators/SearchResponseIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,13 @@ public function rewind()
*/
public function next()
{
if ($this->current_key !== 0) {
$this->current_scrolled_response = $this->client->scroll(
array(
'scroll_id' => $this->scroll_id,
'scroll' => $this->scroll_ttl
)
);
$this->scroll_id = $this->current_scrolled_response['_scroll_id'];
}
$this->current_scrolled_response = $this->client->scroll(
array(
'scroll_id' => $this->scroll_id,
'scroll' => $this->scroll_ttl
)
);
$this->scroll_id = $this->current_scrolled_response['_scroll_id'];
$this->current_key++;
}

Expand Down

0 comments on commit 37da9d5

Please sign in to comment.