Skip to content

Commit 71840d3

Browse files
vEpiphytehonzakral
authored andcommitted
Support http.publish_host addresses
1 parent 4353aa2 commit 71840d3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

elasticsearch/transport.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,16 @@ def _get_host_info(self, host_info):
245245
if not address or ":" not in address:
246246
return None
247247

248-
host["host"], host["port"] = address.rsplit(":", 1)
249-
host["port"] = int(host["port"])
248+
if '/' in address:
249+
# Support 7.x host/ip:port behavior where http.publish_host has been set.
250+
fqdn, ipaddress = address.split('/', 1)
251+
host["host"] = fqdn
252+
_, host["port"] = ipaddress.rsplit(':', 1)
253+
host["port"] = int(host["port"])
254+
255+
else:
256+
host["host"], host["port"] = address.rsplit(":", 1)
257+
host["port"] = int(host["port"])
250258

251259
return self.host_info_callback(host_info, host)
252260

0 commit comments

Comments
 (0)