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