| @@ 233-250 (lines=18) @@ | ||
| 230 | $this->handleBulkError($responses, 'Error occurred during bulk index'); |
|
| 231 | } |
|
| 232 | ||
| 233 | public function refreshIndex(string $indexName): void |
|
| 234 | { |
|
| 235 | if (! $this->isEnabled()) { |
|
| 236 | return; |
|
| 237 | } |
|
| 238 | ||
| 239 | $params = [ |
|
| 240 | 'index' => $indexName, |
|
| 241 | ]; |
|
| 242 | ||
| 243 | if (! empty($this->timeout)) { |
|
| 244 | $params['client'] = [ |
|
| 245 | 'timeout' => $this->timeout, |
|
| 246 | ]; |
|
| 247 | } |
|
| 248 | ||
| 249 | $this->client->indices()->refresh($params); |
|
| 250 | } |
|
| 251 | ||
| 252 | public function performSearch(ElasticsearchQueryContract $query): array |
|
| 253 | { |
|
| @@ 252-268 (lines=17) @@ | ||
| 249 | $this->client->indices()->refresh($params); |
|
| 250 | } |
|
| 251 | ||
| 252 | public function performSearch(ElasticsearchQueryContract $query): array |
|
| 253 | { |
|
| 254 | if (! $this->isEnabled()) { |
|
| 255 | return []; |
|
| 256 | } |
|
| 257 | ||
| 258 | $params = $query->build(); |
|
| 259 | if (! empty($this->timeout)) { |
|
| 260 | $params['client'] = [ |
|
| 261 | 'timeout' => $this->timeout, |
|
| 262 | ]; |
|
| 263 | } |
|
| 264 | ||
| 265 | $results = $this->client->search($params); |
|
| 266 | ||
| 267 | return $results; |
|
| 268 | } |
|
| 269 | ||
| 270 | public function switchIndexAlias(string $aliasName, string $indexName): void |
|
| 271 | { |
|