Conditions | 4 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
27 | public function getItems(): \Generator |
||
28 | { |
||
29 | $query = $this->query; |
||
30 | $query['scroll'] = $this->scollTTL; |
||
31 | |||
32 | $response = $this->client->search($this->query); |
||
33 | |||
34 | while (isset($response['hits']['hits']) && count($response['hits']['hits']) > 0) { |
||
35 | |||
36 | foreach ($response['hits']['hits'] as $doc) { |
||
37 | yield $doc; |
||
38 | } |
||
39 | |||
40 | $response = $client->scroll([ |
||
41 | 'scroll_id' => $response['_scroll_id'], |
||
42 | 'scroll' => $this->scrollTTL, |
||
43 | ] |
||
44 | ); |
||
45 | } |
||
46 | } |
||
47 | } |