# \[SOLVED \]Elasticsearch-py scroll-id http.client.BadStatusLine: ''

**URL:** <https://discuss.elastic.co/t/solved-elasticsearch-py-scroll-id-http-client-badstatusline/54057>\
**Category:** Elasticsearch\
**Created:** [June 27, 2016, 3:44pm UTC](https://discuss.elastic.co/t/solved-elasticsearch-py-scroll-id-http-client-badstatusline/54057 "2016-06-27T15:44:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zendel](https://avatars.discourse-cdn.com/v4/letter/z/d2c977/32.png) [@zendel](https://discuss.elastic.co/u/zendel)\
**Post date:** [June 27, 2016, 3:44pm UTC](https://discuss.elastic.co/t/solved-elasticsearch-py-scroll-id-http-client-badstatusline/54057/1 "2016-06-27T15:44:53Z")

</div>

Hello,

> Name: elasticsearch  
> Version: 2.3.0  
> Location: /usr/lib/python3.4/site-packages  
> Requires: urllib3

When i use scan/scroll with a large result (\>1M), i have this error :

> GET [http://localhost:9200/\_search/scroll?scroll=1m](http://localhost:9200/_search/scroll?scroll=1m) [status:N/A request:2.608s]  
> ...  
> http.client.BadStatusLine: ''

After my research, this bug is already [fixed here](https://github.com/elastic/elasticsearch-py/pull/28/commits/403040056a29c000aa9df2e9dae043a6eb552dd2)

My scroll\_id make 2316 chars

If i check "elasticsearch/client/ **init**.py", i see line 681

> return self.transport.perform\_request('GET', '/\_search/scroll',  
> params=params, body=body)

So, its another bug or its the same ?

Thank for help

---

<div class="post-metadata">

**Author:** ![zendel](https://avatars.discourse-cdn.com/v4/letter/z/d2c977/32.png) [@zendel](https://discuss.elastic.co/u/zendel)\
**Post date:** [June 27, 2016, 4:09pm UTC](https://discuss.elastic.co/t/solved-elasticsearch-py-scroll-id-http-client-badstatusline/54057/2 "2016-06-27T16:09:36Z")

</div>

I think is not the same bug. I test different scroll\_id with same length, and sometime works, sometime not.

The Full error message

> GET [http://localhost:9200/\_search/scroll?scroll=2m](http://localhost:9200/_search/scroll?scroll=2m) [status:N/A request:4.500s]

> Traceback (most recent call last):  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 559, in urlopen  
> body=body, headers=headers)  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 378, in \_make\_request  
> httplib\_response = conn.getresponse()  
> File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse  
> response.begin()  
> File "/usr/lib/python3.4/http/client.py", line 351, in begin  
> version, status, reason = self.\_read\_status()  
> File "/usr/lib/python3.4/http/client.py", line 321, in \_read\_status  
> raise BadStatusLine(line)  
> http.client.BadStatusLine: ''

> During handling of the above exception, another exception occurred:

> Traceback (most recent call last):  
> File "/usr/lib/python3.4/site-packages/elasticsearch/connection/http\_urllib3.py", line 94, in perform\_request  
> response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, \*\*kw)  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 609, in urlopen  
> \_stacktrace=sys.exc\_info()[2])  
> File "/usr/lib/python3.4/site-packages/urllib3/util/retry.py", line 222, in increment  
> raise six.reraise(type(error), error, \_stacktrace)  
> File "/usr/lib/python3.4/site-packages/urllib3/packages/six.py", line 309, in reraise  
> raise value.with\_traceback(tb)  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 559, in urlopen  
> body=body, headers=headers)  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 378, in \_make\_request  
> httplib\_response = conn.getresponse()  
> File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse  
> response.begin()  
> File "/usr/lib/python3.4/http/client.py", line 351, in begin  
> version, status, reason = self.\_read\_status()  
> File "/usr/lib/python3.4/http/client.py", line 321, in \_read\_status  
> raise BadStatusLine(line)  
> urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine("''",))  
> GET [http://localhost:9200/\_search/scroll?scroll=2m](http://localhost:9200/_search/scroll?scroll=2m) [status:N/A request:5.014s]  
> Traceback (most recent call last):  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 376, in \_make\_request  
> httplib\_response = conn.getresponse(buffering=True)  
> TypeError: getresponse() got an unexpected keyword argument 'buffering'

> During handling of the above exception, another exception occurred:

> Traceback (most recent call last):  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 559, in urlopen  
> body=body, headers=headers)  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 378, in \_make\_request  
> httplib\_response = conn.getresponse()  
> File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse  
> response.begin()  
> File "/usr/lib/python3.4/http/client.py", line 351, in begin  
> version, status, reason = self.\_read\_status()  
> File "/usr/lib/python3.4/http/client.py", line 321, in \_read\_status  
> raise BadStatusLine(line)  
> http.client.BadStatusLine: ''

> During handling of the above exception, another exception occurred:

> Traceback (most recent call last):  
> File "/usr/lib/python3.4/site-packages/elasticsearch/connection/http\_urllib3.py", line 94, in perform\_request  
> response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, \*\*kw)  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 609, in urlopen  
> \_stacktrace=sys.exc\_info()[2])  
> File "/usr/lib/python3.4/site-packages/urllib3/util/retry.py", line 222, in increment  
> raise six.reraise(type(error), error, \_stacktrace)  
> File "/usr/lib/python3.4/site-packages/urllib3/packages/six.py", line 309, in reraise  
> raise value.with\_traceback(tb)  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 559, in urlopen  
> body=body, headers=headers)  
> File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 378, in \_make\_request  
> httplib\_response = conn.getresponse()  
> File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse  
> response.begin()  
> File "/usr/lib/python3.4/http/client.py", line 351, in begin  
> version, status, reason = self.\_read\_status()  
> File "/usr/lib/python3.4/http/client.py", line 321, in \_read\_status  
> raise BadStatusLine(line)  
> urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine("''",))

---

<div class="post-metadata">

**Author:** ![zendel](https://avatars.discourse-cdn.com/v4/letter/z/d2c977/32.png) [@zendel](https://discuss.elastic.co/u/zendel)\
**Post date:** [June 28, 2016, 8:58am UTC](https://discuss.elastic.co/t/solved-elasticsearch-py-scroll-id-http-client-badstatusline/54057/3 "2016-06-28T08:58:09Z")

</div>

I fixed this bug.

The cause is ES\_HEAD\_SIZE by default to small.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:40pm UTC](https://discuss.elastic.co/t/solved-elasticsearch-py-scroll-id-http-client-badstatusline/54057/4 "2017-07-05T22:40:00Z")

</div>


