Writing your own Connection Class

edit

Writing your own Connection Class

edit

If you wish to completely write your own connection class, you just need to implement the ConnectionInterface.

namespace Elasticsearch\Connections;

use Psr\Log\LoggerInterface;

interface ConnectionInterface
{
    public function __construct($hostDetails, $connectionParams, LoggerInterface $log, LoggerInterface $trace);

    public function getTransportSchema();

    public function isAlive();

    public function markAlive();

    public function markDead();

    public function getLastRequestInfo();

    public function performRequest($method, $uri, $params = null, $body = null);
}

The abstract AbstractConnection class provides useful boilerplate which you may wish to extend, such as various utility logging methods.