IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Example: Configuring HTTP Basic Auth
editExample: Configuring HTTP Basic Auth
editHTTP basic authentication is a very common requirement. To enable Basic Auth in the client, simply set a parameter with the required auth parameters:
$params = array(); $params['connectionParams']['auth'] = array( 'username', 'password', 'Basic' ); $client = new Elasticsearch\Client($params);
After being initialized with authentication credentials, all outgoing requests will automatically include the HTTP auth headers.