| @@ 216-233 (lines=18) @@ | ||
| 213 | throw new ElasticSearchException('Error occurred during bulk update', $errors); |
|
| 214 | } |
|
| 215 | ||
| 216 | public function refreshIndex(string $index_name) |
|
| 217 | { |
|
| 218 | if (! $this->isEnabled()) { |
|
| 219 | return; |
|
| 220 | } |
|
| 221 | ||
| 222 | $params = [ |
|
| 223 | 'index' => $index_name, |
|
| 224 | ]; |
|
| 225 | ||
| 226 | if (! empty($this->timeout)) { |
|
| 227 | $params['client'] = [ |
|
| 228 | 'timeout' => $this->timeout, |
|
| 229 | ]; |
|
| 230 | } |
|
| 231 | ||
| 232 | $this->client->indices()->refresh($params); |
|
| 233 | } |
|
| 234 | ||
| 235 | public function performSearch(ElasticSearchQueryContract $query): array |
|
| 236 | { |
|
| @@ 235-251 (lines=17) @@ | ||
| 232 | $this->client->indices()->refresh($params); |
|
| 233 | } |
|
| 234 | ||
| 235 | public function performSearch(ElasticSearchQueryContract $query): array |
|
| 236 | { |
|
| 237 | if (! $this->isEnabled()) { |
|
| 238 | return []; |
|
| 239 | } |
|
| 240 | ||
| 241 | $params = $query->build(); |
|
| 242 | if (! empty($this->timeout)) { |
|
| 243 | $params['client'] = [ |
|
| 244 | 'timeout' => $this->timeout, |
|
| 245 | ]; |
|
| 246 | } |
|
| 247 | ||
| 248 | $results = $this->client->search($params); |
|
| 249 | ||
| 250 | return $results; |
|
| 251 | } |
|
| 252 | ||
| 253 | public function switchIndexAlias(string $alias_name, string $index_name) |
|
| 254 | { |
|