/**
* Make a new connection, and wrap the client in our handler Client.
*
* @param $name
* @return \Elasticsearch\Client|mixed
*/
protected function makeConnection($name)
{
// Create a base ES client for the connection.
$baseClient = parent::makeConnection($name);
// Find the base client wrapper class.
$handlerClass = $this->getHandlerClass();
// Load the handlers for this configuration.
$handlers = $this->getConnectionHandlers($name);
// Create a "wrapped" client passing in the appropriate configuration
return new $handlerClass($baseClient, $handlers);
}