Skip to content

Commit b7ae7ef

Browse files
committed
Fix SearchResponseIterator scroll first page twice (elastic#595)
1 parent d3c5b55 commit b7ae7ef

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/Elasticsearch/Helper/Iterators/SearchResponseIterator.php

+7-9
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,13 @@ public function rewind()
128128
*/
129129
public function next()
130130
{
131-
if ($this->current_key !== 0) {
132-
$this->current_scrolled_response = $this->client->scroll(
133-
array(
134-
'scroll_id' => $this->scroll_id,
135-
'scroll' => $this->scroll_ttl
136-
)
137-
);
138-
$this->scroll_id = $this->current_scrolled_response['_scroll_id'];
139-
}
131+
$this->current_scrolled_response = $this->client->scroll(
132+
array(
133+
'scroll_id' => $this->scroll_id,
134+
'scroll' => $this->scroll_ttl
135+
)
136+
);
137+
$this->scroll_id = $this->current_scrolled_response['_scroll_id'];
140138
$this->current_key++;
141139
}
142140

0 commit comments

Comments
 (0)