Setting the Connection Selector

edit

Setting the Connection Selector

edit

The connection pool manages the connections to your cluster, but the Selector is the logic that decides which connection should be used for the next API request. There are several selectors that you can choose from. Selectors can be changed via the setSelector() method:

$selector = '\Elasticsearch\ConnectionPool\Selectors\StickyRoundRobinSelector';
$client = ClientBuilder::create()
            ->setSelector($selector)
            ->build();

For more details, please see the dedicated page on configuring selectors.