/** * This indexes one single bean to Elastic Search engine * @param SugarBean $bean */ public function indexSingleBean($bean) { $this->logger->info("Preforming single bean index"); try { $indexName = $this->getWriteIndexForBean($bean); $this->logger->debug("Writing bean {$bean->id} to index {$indexName}"); $index = new \Elastica\Index($this->_client, $indexName); $type = new \Elastica\Type($index, $this->getIndexType($bean)); $doc = $this->createIndexDocument($bean); if ($doc != null) { $type->addDocument($doc); } } catch (Exception $e) { $this->reportException("Unable to index bean", $e); if ($this->checkException($e)) { $recordsToBeQueued = $this->getRecordsFromDocs(array($doc)); $this->addRecordsToQueue($recordsToBeQueued); } } }