SSLError: ConnectionErro SSL: WRONG_VERSION_NUMBER

After enabling Xpack and setting SSL/TSL for a single node and username and password, i am trying to index a single data point

from elasticsearch import Elasticsearch
from datetime import datetime
es = Elasticsearch(
    ['server'],
    http_auth=('user', 'password'),
    scheme="https",
    port=9200,
)

doc = {
    'author': 'kimchy',
    'text': 'Elasticsearch: cool. bonsai cool.',
    'timestamp': datetime.now(),
}
res = es.index(index="test-index", id=1, body=doc)

and i get

SSLError: ConnectionError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1076)) caused by: SSLError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1076))

my SSL version in python and server match. The terminal commands below return the same values

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

i tried a variety of settings based on online research such as

from elasticsearch import RequestsHttpConnection
es = Elasticsearch("https://user:password@server:9200")
es = Elasticsearch("https://user:password@server:9200", ca_certs=False, verify_certs=False)
es = Elasticsearch(["server"], port=9200, connection_class=RequestsHttpConnection, http_auth=('user', 'password'), use_ssl=True, verify_certs=False)

Hi @pemfir would you be willing to post this connection error to the Elastic Stack > Elasticsearch category, where other users have asked about similar connection errors, linked below?

The Elastic Security category is specific to to the Elastic Security Solution.

Thank you ! Changed the category. i do not see any question/answer for the issue i have raised here, and now with your response, i may not get much attention as readers may assume this question has already been answered. I have spent a lot of time on fixing this, and would appreciate some hints.

Can you provide your elasticsearch node configuration (elasticsearch.yml) ?

Have you successfully connected to your node via curl or Kibana? If so, can you provide an example of the curl command & output?

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