| @@ 337-352 (lines=16) @@ | ||
| 334 | return $results['count']; |
|
| 335 | } |
|
| 336 | ||
| 337 | public function remove($id, $routing = null) |
|
| 338 | { |
|
| 339 | $params = [ |
|
| 340 | 'index' => $this->getIndexName(), |
|
| 341 | 'type' => $this->getTypeName(), |
|
| 342 | 'id' => $id, |
|
| 343 | ]; |
|
| 344 | ||
| 345 | if ($routing) { |
|
| 346 | $params['routing'] = $routing; |
|
| 347 | } |
|
| 348 | ||
| 349 | $response = $this->getClient()->delete($params); |
|
| 350 | ||
| 351 | return $response; |
|
| 352 | } |
|
| 353 | ||
| 354 | public function update($id, array $fields = [], $script = null, array $params = []): array |
|
| 355 | { |
|
| @@ 376-394 (lines=19) @@ | ||
| 373 | return $this->getClient()->update($params); |
|
| 374 | } |
|
| 375 | ||
| 376 | public function search(array $query, array $params = []): array |
|
| 377 | { |
|
| 378 | $requestParams = [ |
|
| 379 | 'index' => $this->getIndexName(), |
|
| 380 | 'type' => $this->getTypeName(), |
|
| 381 | 'body' => $query, |
|
| 382 | ]; |
|
| 383 | ||
| 384 | ||
| 385 | if (!empty($params)) { |
|
| 386 | $requestParams = array_merge($requestParams, $params); |
|
| 387 | } |
|
| 388 | ||
| 389 | // $this->stopwatch('start', 'search'); |
|
| 390 | $result = $this->getClient()->search($requestParams); |
|
| 391 | // $this->stopwatch('stop', 'search'); |
|
| 392 | ||
| 393 | return $result; |
|
| 394 | } |
|
| 395 | ||
| 396 | /** |
|
| 397 | * Usage example |
|