/** * Convert a log message into an Elastica Document * * @param array $record Log message * @return \Elastica\Document */ protected function getDocument($record) { $document = new Elastica\Document(); $document->setData($record); $document->setType($this->type); $document->setIndex($this->index); return $document; }
/** * Returns Document * * @return \Elastica\Document */ public function getDocument() { $doc = new \Elastica\Document(); $doc->setData($this->getSource()); $hit = $this->getHit(); if ($this->hasParam('_source')) { unset($hit['_source']); } if ($this->hasParam('_explanation')) { unset($hit['_explanation']); } if ($this->hasParam('highlight')) { unset($hit['highlight']); } if ($this->hasParam('_score')) { unset($hit['_score']); } $doc->setParams($hit); return $doc; }