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