Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ Hosts should be comma seperated string of hosts with protocol prefix and port su
ELASTICSEARCH_USERNAME=admin
ELASTICSEARCH_PASSWORD=admin
ELASTICSEARCH_SSL_VERIFICATION=true,
ELASTICSEARCH_API_KEY=
```

## Async Usage
Expand Down
1 change: 1 addition & 0 deletions config/laravel-elastic-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'username' => env('ELASTICSEARCH_USERNAME', ''),
'password' => env('ELASTICSEARCH_PASSWORD', ''),
'ssl_verification' => env('ELASTICSEARCH_SSL_VERIFICATION', false),
'api_key' => env('ELASTICSEARCH_API_KEY', ''),

'http_client' => null, // class implementing the \Psr\Http\Client\ClientInterface
'http_client_options' => null, // for call_user_func_array
Expand Down
4 changes: 4 additions & 0 deletions src/ElasticClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ public static function fromConfig(array $config): static
$builder->setBasicAuthentication($username, $password);
}

if (filled($config['api_key']) ?? null) {
$builder->setApiKey($config['api_key']);
}

if (filled($config['http_client_logger'] ?? null)) {
$logger = call_user_func_array($config['http_client_logger'], []);

Expand Down