/**
  * Populates elasticsearch with data.
  *
  * @param IndexManager $indexManager
  * @param array        $data
  */
 protected function populateElasticsearchWithData($indexManager, array $data)
 {
     if (!empty($data)) {
         foreach ($data as $type => $documents) {
             foreach ($documents as $document) {
                 $indexManager->persistRaw($type, $document);
             }
         }
         $indexManager->getConnection()->commit();
         $indexManager->getConnection()->refresh();
     }
 }
 /**
  * Populates elasticsearch with data.
  *
  * @param IndexManager $indexManager
  * @param array        $data
  */
 protected function populateElasticsearchWithData($indexManager, array $data)
 {
     if (!empty($data)) {
         foreach ($data as $type => $documents) {
             foreach ($documents as $document) {
                 $indexManager->persistRaw($type, $document);
             }
         }
         try {
             $indexManager->getConnection()->commit();
             $indexManager->getConnection()->refresh();
         } catch (BulkRequestException $e) {
             print_r($e->getBulkResponseItems());
             throw $e;
         }
     }
 }
 /**
  * Adds a prepared document array to a bulk request for the next commit.
  * Depending on the connection autocommit mode, the update may be committed right away.
  *
  * @param array $documentArray The document to index in ES
  */
 public function persistRaw(array $documentArray)
 {
     $this->indexManager->persistRaw($this->documentClass, $documentArray);
 }
 /**
  * Reindex a single document in the ES index
  *
  * @param int $id
  */
 public function reindex($id)
 {
     $this->indexManager->reindex($this->documentClass, $id);
 }