| @@ 247-264 (lines=18) @@ | ||
| 244 | throw new ElasticsearchException($message, $errors); |
|
| 245 | } |
|
| 246 | ||
| 247 | public function refreshIndex(string $index_name): void |
|
| 248 | { |
|
| 249 | if (! $this->isEnabled()) { |
|
| 250 | return; |
|
| 251 | } |
|
| 252 | ||
| 253 | $params = [ |
|
| 254 | 'index' => $index_name, |
|
| 255 | ]; |
|
| 256 | ||
| 257 | if (! empty($this->timeout)) { |
|
| 258 | $params['client'] = [ |
|
| 259 | 'timeout' => $this->timeout, |
|
| 260 | ]; |
|
| 261 | } |
|
| 262 | ||
| 263 | $this->client->indices()->refresh($params); |
|
| 264 | } |
|
| 265 | ||
| 266 | public function performSearch(ElasticsearchQueryContract $query): array |
|
| 267 | { |
|
| @@ 266-282 (lines=17) @@ | ||
| 263 | $this->client->indices()->refresh($params); |
|
| 264 | } |
|
| 265 | ||
| 266 | public function performSearch(ElasticsearchQueryContract $query): array |
|
| 267 | { |
|
| 268 | if (! $this->isEnabled()) { |
|
| 269 | return []; |
|
| 270 | } |
|
| 271 | ||
| 272 | $params = $query->build(); |
|
| 273 | if (! empty($this->timeout)) { |
|
| 274 | $params['client'] = [ |
|
| 275 | 'timeout' => $this->timeout, |
|
| 276 | ]; |
|
| 277 | } |
|
| 278 | ||
| 279 | $results = $this->client->search($params); |
|
| 280 | ||
| 281 | return $results; |
|
| 282 | } |
|
| 283 | ||
| 284 | public function switchIndexAlias(string $alias_name, string $index_name): void |
|
| 285 | { |
|