diff --git a/elasticsearch/transport.py b/elasticsearch/transport.py index fa494fb76..70715f27e 100644 --- a/elasticsearch/transport.py +++ b/elasticsearch/transport.py @@ -219,8 +219,8 @@ def _get_host_info(self, host_info): host = {} address = host_info.get('http', {}).get('publish_address') - # malformed address - if ':' not in address: + # malformed or no address given + if not address or ':' not in address: return None host['host'], host['port'] = address.rsplit(':', 1)