简体   繁体   English

elastic_transport.TlsError:TLS错误导致:TlsError(TLS错误导致:SSLError([SSL:WRONG_VERSION_NUMBER]版本号错误(_ssl.c:852)))

[英]elastic_transport.TlsError: TLS error caused by:TlsError(TLS error caused by: SSLError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:852)))

Getting this error Trying to connect elasticsearch docker container with elasticsearch-python client.出现此错误尝试将 elasticsearch docker 容器与 elasticsearch-python 客户端连接。

    /home/raihan/dev/aims_lab/ai_receptionist/env/lib/python3.6/site-packages/elasticsearch/_sync/client/__init__.py:379: SecurityWarning: Connecting to 'https://localhost:9200' using TLS with verify_certs=False is insecure
  **transport_kwargs,
<Elasticsearch(['https://localhost:9200'])>
Traceback (most recent call last):
  File "test_all.py", line 29, in <module>
    resp = es.index(index="test-index", id=1, document=doc)
  File "/home/raihan/dev/aims_lab/ai_receptionist/env/lib/python3.6/site-packages/elasticsearch/_sync/client/utils.py", line 404, in wrapped
    return api(*args, **kwargs)
  File "/home/raihan/dev/aims_lab/ai_receptionist/env/lib/python3.6/site-packages/elasticsearch/_sync/client/__init__.py", line 2218, in index
    __method, __path, params=__query, headers=__headers, body=__body
  File "/home/raihan/dev/aims_lab/ai_receptionist/env/lib/python3.6/site-packages/elasticsearch/_sync/client/_base.py", line 295, in perform_request
    client_meta=self._client_meta,
  File "/home/raihan/dev/aims_lab/ai_receptionist/env/lib/python3.6/site-packages/elastic_transport/_transport.py", line 334, in perform_request
    request_timeout=request_timeout,
  File "/home/raihan/dev/aims_lab/ai_receptionist/env/lib/python3.6/site-packages/elastic_transport/_node/_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.TlsError: TLS error caused by: TlsError(TLS error caused by: SSLError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:852)))

contents in elastic.py elastic.py 中的内容

    host = "https://localhost:9200"
es = Elasticsearch(host, ca_certs=False, verify_certs=False)
print(es)

doc = {
    'author': 'kimchy',
    'text': 'Elasticsearch: cool. bonsai cool.',
    'timestamp': datetime.now(),
}
resp = es.index(index="test-index", id=1, document=doc)
print(resp['result'])

resp = es.get(index="test-index", id=1)
print(resp['_source'])

contents in elasticsearch dockerfile elasticsearch dockerfile 中的内容

FROM docker.elastic.co/elasticsearch/elasticsearch:7.12.0
RUN elasticsearch-plugin install --batch https://github.com/alexklibisz/elastiknn/releases/download/7.12.0.0/elastiknn-7.12.0.0.zip

urllib3==1.26.9 requests==2.27.1 urllib3==1.26.9 请求==2.27.1

您应该将“https”更改为“http”,这就是答案

您必须检查 localhost 的 https 和 http。

#disable certificate
s = Elasticsearch(hosts="https://localhost:9200", basic_auth=(USER, PASS), verify_certs=False)

Reference Follow for more参考关注更多

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 python 请求:(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] 错误的版本号 (_ssl.c:1123)')) - python requests: (SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')) 如何修复 ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] 错误的版本号 (_ssl.c:1056)? - How to fix ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)? python elasticsearch elasticsearch.exceptions.SSLError: ConnectionError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)) - python elasticsearch elasticsearch.exceptions.SSLError: ConnectionError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)) 如何修复错误 ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] 版本号错误? - How to fix the error ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number? Flask-Mail [SSL: WRONG_VERSION_NUMBER] 错误的版本号 (_ssl.c:1123) - Flask-Mail [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123) django2.1发送电子邮件失败:ssl.SSLError:[SSL:WRONG_VERSION_NUMBER]版本号错误(_ssl.c:833) - django2.1 send email fail:ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:833) Python-Django [SSL:WRONG_VERSION_NUMBER]错误 - Python-Django [SSL: WRONG_VERSION_NUMBER] Error SSL:PYTHON 请求上的 WRONG_VERSION_NUMBER - SSL: WRONG_VERSION_NUMBER ON PYTHON REQUEST jupyter SSL:WRONG_VERSION_NUMBER - jupyter SSL: WRONG_VERSION_NUMBER 尝试重新包装套接字时出现错误 [SSL: WRONG_VERSION_NUMBER] - Error [SSL: WRONG_VERSION_NUMBER] when trying to re-wrap a socket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM