@@ 311-322 (lines=12) @@ | ||
308 | * |
|
309 | * @return \Elastica\Bulk\ResponseSet Response object |
|
310 | */ |
|
311 | public function updateDocuments(array $docs) |
|
312 | { |
|
313 | if (empty($docs)) { |
|
314 | throw new InvalidException('Array has to consist of at least one element'); |
|
315 | } |
|
316 | ||
317 | $bulk = new Bulk($this); |
|
318 | ||
319 | $bulk->addDocuments($docs, Action::OP_TYPE_UPDATE); |
|
320 | ||
321 | return $bulk->send(); |
|
322 | } |
|
323 | ||
324 | /** |
|
325 | * Uses _bulk to send documents to the server. |
|
@@ 339-350 (lines=12) @@ | ||
336 | * |
|
337 | * @return \Elastica\Bulk\ResponseSet Response object |
|
338 | */ |
|
339 | public function addDocuments(array $docs) |
|
340 | { |
|
341 | if (empty($docs)) { |
|
342 | throw new InvalidException('Array has to consist of at least one element'); |
|
343 | } |
|
344 | ||
345 | $bulk = new Bulk($this); |
|
346 | ||
347 | $bulk->addDocuments($docs); |
|
348 | ||
349 | return $bulk->send(); |
|
350 | } |
|
351 | ||
352 | /** |
|
353 | * Update document, using update script. Requires elasticsearch >= 0.19.0. |
|
@@ 471-481 (lines=11) @@ | ||
468 | * |
|
469 | * @return \Elastica\Bulk\ResponseSet |
|
470 | */ |
|
471 | public function deleteDocuments(array $docs) |
|
472 | { |
|
473 | if (empty($docs)) { |
|
474 | throw new InvalidException('Array has to consist of at least one element'); |
|
475 | } |
|
476 | ||
477 | $bulk = new Bulk($this); |
|
478 | $bulk->addDocuments($docs, Action::OP_TYPE_DELETE); |
|
479 | ||
480 | return $bulk->send(); |
|
481 | } |
|
482 | ||
483 | /** |
|
484 | * Returns the status object for all indices. |