Array of \Elastica\Document as input. Index and type has to be
set inside the document, because for bulk settings documents,
documents can belong to any type and index
public addDocuments ( array $docs ) : |
||
$docs | array | Array of Elastica\Document |
return | Response object |
/** * Use Elasticsearch bulk API to send list of documents * @param array $documents * @throws \RuntimeException */ protected function bulkSend(array $documents) { try { $this->client->addDocuments($documents); } catch (ExceptionInterface $e) { if (!$this->options['ignore_error']) { throw new \RuntimeException("Error sending messages to Elasticsearch", 0, $e); } } }
/** * Uses _bulk to send documents to the server. * * Array of \Elastica\Document as input. Index and type has to be * set inside the document, because for bulk settings documents, * documents can belong to any type and index * * @param array|\Elastica\Document[] $docs Array of Elastica\Document * @return \Elastica\Bulk\ResponseSet Response object * @throws \Elastica\Exception\InvalidException If docs is empty * @link http://www.elasticsearch.org/guide/reference/api/bulk.html */ public function addDocuments(array $docs) { return $this->client->addDocuments($docs); }