IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
RoundRobinSelector (Default)
editRoundRobinSelector (Default)
editThis selector returns connections in a round-robin fashion. Node #1 is selected on the first request, Node #2 on the second request, etc. This ensures an even load of traffic across your cluster. Round-robin’ing happens on a per-request basis (e.g. sequential requests go to different nodes).
The RoundRobinSelector
is default, but if you wish to explicitily configure it you can do:
$client = ClientBuilder::create() ->setSelector('\Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector') ->build();
Note that the implementation is specified via a namespace path to the class.