Meeting a ConnectionError when python connect the elasticsearch?

Code:
from elasticsearch import Elasticsearch
from ssl import create_default_context

context = create_default_context(cafile="XXX.pem")
es = Elasticsearch("https://IP:9200", ssl_context=context, http_auth=('username','password'))
es.info()

ERROR:
/opt/anaconda2/envs/py2/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py:148: UserWarning: When using ssl_context, all other SSL related kwargs are ignored
"When using ssl_context, all other SSL related kwargs are ignored"
Traceback (most recent call last):
File "es.py", line 6, in
es.info()
File "/opt/anaconda2/envs/py2/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 84, in _wrapped
return func(*args, params=params, **kwargs)
File "/opt/anaconda2/envs/py2/lib/python2.7/site-packages/elasticsearch/client/init.py", line 291, in info
return self.transport.perform_request("GET", "/", params=params)
File "/opt/anaconda2/envs/py2/lib/python2.7/site-packages/elasticsearch/transport.py", line 358, in perform_request
timeout=timeout,
File "/opt/anaconda2/envs/py2/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 254, in perform_request
raise ConnectionError("N/A", str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(check_hostname requires server_hostname) caused by: ValueError(check_hostname requires server_hostname)

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.