4

I'm trying to connect to an elasticsearch server using the elasticsearch package, but getting this error

  File "/Users/xxx/.local/share/virtualenvs/backend-J1KVvbjz/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 152, in _wrapped
    return func(*args, params=params, headers=headers, **kwargs)
  File "/Users/xxx/.local/share/virtualenvs/backend-J1KVvbjz/lib/python3.7/site-packages/elasticsearch/client/indices.py", line 331, in exists
    "HEAD", _make_path(index), params=params, headers=headers
  File "/Users/xxx/.local/share/virtualenvs/backend-J1KVvbjz/lib/python3.7/site-packages/elasticsearch/transport.py", line 390, in perform_request
    raise e
  File "/Users/xxx/.local/share/virtualenvs/backend-J1KVvbjz/lib/python3.7/site-packages/elasticsearch/transport.py", line 365, in perform_request
    timeout=timeout,
  File "/Users/xxx/.local/share/virtualenvs/backend-J1KVvbjz/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 255, in perform_request
    raise SSLError("N/A", str(e), e)
elasticsearch.exceptions.SSLError: ConnectionError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)) caused by: SSLError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056))

Any ideas what could be fixing the problem ?

1
  • 1
    In my case, I just changed all https to http in my project code. Commented Jun 17, 2022 at 12:33

1 Answer 1

1
+50

Check your's openssl version

run

openssl version

or from python

python -c "import ssl; print(ssl.OPENSSL_VERSION)"

Both commands need to output something like: LibreSSL 2.8.3

For connecting with this client you probably use something like in their docs:

https://elasticsearch-py.readthedocs.io/en/7.10.0/#ssl-and-authentication

and as you can see at the comment bellow the example you can set some of your own settings on Urllib3HttpConnection

See class Urllib3HttpConnection for detailed description of the options.

https://elasticsearch-py.readthedocs.io/en/7.10.0/connection.html#elasticsearch.Urllib3HttpConnection

There you will see the setting of ssl version

ssl_version – version of the SSL protocol to use. Choices are: SSLv23 (default) SSLv2 SSLv3 TLSv1 (see PROTOCOL_ constants in the ssl module for exact

Try to change this setting and see if it help.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.