From db8513851477b212881d010fe62cf3783f551030 Mon Sep 17 00:00:00 2001 From: prog-24 Date: Sat, 27 Jul 2019 02:37:46 +0100 Subject: [PATCH] To resolve issue #194 Added call to each before working on each chunk. --- src/ElasticquentCollectionTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ElasticquentCollectionTrait.php b/src/ElasticquentCollectionTrait.php index c47906a..24feb34 100644 --- a/src/ElasticquentCollectionTrait.php +++ b/src/ElasticquentCollectionTrait.php @@ -34,7 +34,7 @@ public function addToIndex() // Iterate according to the amount configured, and put that iteration's worth of records into elastic search // This is done so that we do not exceed the maximum request size - $chunkingResult = $this->chunk(static::$entriesToSendToElasticSearchInOneGo, function ($collectionChunk) use ($result) { + $chunkingResult = $this->chunk(static::$entriesToSendToElasticSearchInOneGo)->each(function ($collectionChunk) use ($result) { $params = array(); foreach ($collectionChunk as $item) { $params['body'][] = array(