diff --git a/elasticsearch/connection/base.py b/elasticsearch/connection/base.py index d4fbe33de..cb7ab532f 100644 --- a/elasticsearch/connection/base.py +++ b/elasticsearch/connection/base.py @@ -46,6 +46,16 @@ def __init__(self, host='localhost', port=9200, use_ssl=False, url_prefix='', ti def __repr__(self): return '<%s: %s>' % (self.__class__.__name__, self.host) + def __eq__(self, other): + if not isinstance(other, Connection): + raise TypeError( + "Unsupported equality check for %s and %s" % (self, other) + ) + return True + + def __hash__(self): + return id(self) + def _pretty_json(self, data): # pretty JSON in tracer curl logs try: