/** * Populates elasticsearch with data. * * @param Manager $manager * @param array $data */ protected function populateElasticsearchWithData($manager, array $data) { if (!empty($data)) { foreach ($data as $type => $documents) { foreach ($documents as $document) { $manager->bulk('index', $type, $document); } } $manager->commit(); $manager->refresh(); } }