Example: Configuring HTTP Basic Authedit

HTTP 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);

Accepts four different options: Basic, Digets, NTLM, Any

After being initialized with authentication credentials, all outgoing requests will automatically include the HTTP auth headers.