| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace Elastica\Bulk\Action;
- use Elastica\AbstractUpdateAction;
- use Elastica\Document;
- class IndexDocument extends AbstractDocument
- {
- /**
- * @var string
- */
- protected $_opType = self::OP_TYPE_INDEX;
- /**
- * @param \Elastica\Document $document
- *
- * @return $this
- */
- public function setDocument(Document $document)
- {
- parent::setDocument($document);
- $this->setSource($document->getData());
- return $this;
- }
- /**
- * @param \Elastica\AbstractUpdateAction $action
- *
- * @return array
- */
- protected function _getMetadata(AbstractUpdateAction $action)
- {
- $params = [
- 'index',
- 'type',
- 'id',
- 'version',
- 'version_type',
- 'routing',
- 'parent',
- 'retry_on_conflict',
- ];
- $metadata = $action->getOptions($params, true);
- return $metadata;
- }
- }
|