| @@ 253-270 (lines=18) @@ | ||
| 250 | throw new ElasticSearchException('Error occurred during bulk update', $errors); |
|
| 251 | } |
|
| 252 | ||
| 253 | public function refreshIndex(string $index_name) |
|
| 254 | { |
|
| 255 | if (! $this->isEnabled()) { |
|
| 256 | return; |
|
| 257 | } |
|
| 258 | ||
| 259 | $params = [ |
|
| 260 | 'index' => $index_name, |
|
| 261 | ]; |
|
| 262 | ||
| 263 | if (! empty($this->timeout)) { |
|
| 264 | $params['client'] = [ |
|
| 265 | 'timeout' => $this->timeout, |
|
| 266 | ]; |
|
| 267 | } |
|
| 268 | ||
| 269 | $this->client->indices()->refresh($params); |
|
| 270 | } |
|
| 271 | ||
| 272 | public function performSearch(ElasticSearchQueryContract $query): array |
|
| 273 | { |
|
| @@ 272-288 (lines=17) @@ | ||
| 269 | $this->client->indices()->refresh($params); |
|
| 270 | } |
|
| 271 | ||
| 272 | public function performSearch(ElasticSearchQueryContract $query): array |
|
| 273 | { |
|
| 274 | if (! $this->isEnabled()) { |
|
| 275 | return []; |
|
| 276 | } |
|
| 277 | ||
| 278 | $params = $query->build(); |
|
| 279 | if (! empty($this->timeout)) { |
|
| 280 | $params['client'] = [ |
|
| 281 | 'timeout' => $this->timeout, |
|
| 282 | ]; |
|
| 283 | } |
|
| 284 | ||
| 285 | $results = $this->client->search($params); |
|
| 286 | ||
| 287 | return $results; |
|
| 288 | } |
|
| 289 | ||
| 290 | public function switchIndexAlias(string $alias_name, string $index_name) |
|
| 291 | { |
|