/** * 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 (Elastica\Exception\ExceptionInterface $e) { if (!$this->options['ignore_error']) { throw new RuntimeException("Error sending messages to Elasticsearch", 0, $e); } } }