diff --git a/elasticsearch/connection_pool.py b/elasticsearch/connection_pool.py index 64bdb13c..c7541e15 100644 --- a/elasticsearch/connection_pool.py +++ b/elasticsearch/connection_pool.py @@ -12,6 +12,14 @@ class ConnectionSelector(object): self.connection_opts = opts +class RandomSelector(ConnectionSelector): + """ + Select a connection at random + """ + def select(self, connections): + return random.choice(connections) + + class RoundRobinSelector(ConnectionSelector): " Default selector using round-robin. " def __init__(self, opts):