http_compress=True results in ProtocolError(('Connection aborted.', BadStatusLine("''",)))
See original GitHub issuees = Elasticsearch(hosts=['http://localhost:9200'], http_compress=True)
res = es.index(index="test-index", doc_type='testtype', body={'text': 'test'})
raises
File "tst.py", line 16, in main
res = es.index(index="test-index", doc_type='testtype', body=doc)
File "/home/ubuntu/venv/local/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 76, in _wrapped
return func(*args, params=params, **kwargs)
File "/home/ubuntu/venv/local/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 319, in index
_make_path(index, doc_type, id), params=params, body=body)
File "/home/ubuntu/venv/local/lib/python2.7/site-packages/elasticsearch/transport.py", line 318, in perform_request
status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
File "/home/ubuntu/venv/local/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 181, in perform_request
raise ConnectionError('N/A', str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(('Connection aborted.', BadStatusLine("''",))) caused by: ProtocolError(('Connection aborted.', BadStatusLine("''",)))
If I disable http_compress
, it works as expected.
Env:
elasticsearch-6.3.1
urllib3-1.23
elasticsearch-oss 6.4.2
http.compression: true
Ubuntu 18.04.1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Python requests.exception.ConnectionError - Stack Overflow
The problem was with the url. This connection was meant to be established over https and I was using http in the python...
Read more >1248167 – [RHCI] Connection aborted BadStatusLIne during ...
This error occurs when the upstream server returns an HTTP status line (e.g. 'HTTP/1.1 200 OK') that can't be parsed by Python's httplib....
Read more >connection aborted bad statusline - Google Groups
urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine("''",)). During handling of the above exception, another exception occurred:.
Read more >ConnectionError: ('Connection aborted.', BadStatusLine
It is telling you there was a bad status line, and what the bad status line contents was. (Used to be you couldn't...
Read more >('Connection aborted.', BadStatusLine("''",)) - Bugzilla@Mozilla
Intermittent ConnectionError: ('Connection aborted.', BadStatusLine("''",)).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think that a workaround might be to choose a different transport layer (but I didn’t check if it really compressing requests) :
Elasticsearch(hosts=[{"host": "localhost", "port": 9200}], connection_class=RequestsHttpConnection, http_compress=True)
Note that it requires
requests
installation:pip install requests
I am also facing the same issue as described by @itayB. With http_compress = True it’s not working and without that param, it’s working.