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
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Example: 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.