[[connection-selector]]
=== Connection selector

Connection selector is a simple class used to select a connection from a list of 
currently live connection instances. Initially, it is passed a dictionary 
containing all the connections options which it can then use during the 
selection process. When the _select_ method is called it is given a list of 
currently live connections to choose from.

The options dictionary is passed to `Transport` as the hosts parameter and the 
same is used to construct the connection object itself. When the connection was 
created based on information retrieved from the cluster via the sniffing 
process, it is the dictionary returned by the `host_info_callback`.

Example of where this might be useful is a zone-aware selector that would only 
select connections from its own zones and only fall back to other connections 
where there would be none in its zones.

For reference information, refer to the 
https://elasticsearch-py.readthedocs.io/en/latest/connection.html#connection-selector[full {es} Python documentation].