# KeyError using python helpers.scan

**URL:** <https://discuss.elastic.co/t/keyerror-using-python-helpers-scan/20096>\
**Category:** Elasticsearch\
**Created:** [October 6, 2014, 5:21pm UTC](https://discuss.elastic.co/t/keyerror-using-python-helpers-scan/20096 "2014-10-06T17:21:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruno\_Ribeiro\_da\_Sil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bruno_ribeiro_da_sil/32/1231_2.png) [@Bruno\_Ribeiro\_da\_Sil](https://discuss.elastic.co/u/Bruno_Ribeiro_da_Sil)\
**Post date:** [October 6, 2014, 5:21pm UTC](https://discuss.elastic.co/t/keyerror-using-python-helpers-scan/20096/1 "2014-10-06T17:21:29Z")

</div>

Hi Everyone!

I'm using ES for 6 months in production and today I was caught by an error  
being thrown by helpers.scan() method, what I could see is that scan always  
expect the response to contain the key \_scroll\_id, so I'm trying to  
understand it it's a problem in python wrappers or a problem in my ES  
servers that didn't respond correctly to the request.

Any recommendations?

Thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6e56b021-4193-4152-82fc-df570229cbcf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6e56b021-4193-4152-82fc-df570229cbcf%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Honza\_Kral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/honza_kral/32/876_2.png) [@Honza\_Kral](https://discuss.elastic.co/u/Honza_Kral)\
**Post date:** [October 7, 2014, 7:25am UTC](https://discuss.elastic.co/t/keyerror-using-python-helpers-scan/20096/2 "2014-10-07T07:25:02Z")

</div>

Hi Bruno,

this definitely shouldn't be happening. Could you turn on your logging  
for the python library to see what's going on? Just enabling the  
`elasticsearch` logger in python logging module should do the trick.

Thanks!

On Mon, Oct 6, 2014 at 7:21 PM, Bruno Ribeiro da Silva  
[bruno.devpod@gmail.com](mailto:bruno.devpod@gmail.com) wrote:

> Hi Everyone!
> 
> I'm using ES for 6 months in production and today I was caught by an error  
> being thrown by helpers.scan() method, what I could see is that scan always  
> expect the response to contain the key \_scroll\_id, so I'm trying to  
> understand it it's a problem in python wrappers or a problem in my ES  
> servers that didn't respond correctly to the request.
> 
> Any recommendations?
> 
> Thanks!
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/6e56b021-4193-4152-82fc-df570229cbcf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6e56b021-4193-4152-82fc-df570229cbcf%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CABfdDio9oYB6nswaxpnG%3D7tMxpmTxC3THa710FnPExXzrhnMTg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CABfdDio9oYB6nswaxpnG%3D7tMxpmTxC3THa710FnPExXzrhnMTg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Bruno\_Ribeiro\_da\_Sil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bruno_ribeiro_da_sil/32/1231_2.png) [@Bruno\_Ribeiro\_da\_Sil](https://discuss.elastic.co/u/Bruno_Ribeiro_da_Sil)\
**Post date:** [October 7, 2014, 1:56pm UTC](https://discuss.elastic.co/t/keyerror-using-python-helpers-scan/20096/3 "2014-10-07T13:56:23Z")

</div>

Hi, thanks for the help, this is what I have from my yesterday logs:

INFO 2014-10-06 15:05:03,794  
/env/local/lib/python2.7/site-packages/elasticsearch/connection/base.py:57  
GET [http://192.168.0.1:9200/events/event/\_sea](http://192.168.0.1:9200/events/event/_sea)  
rch?search\_type=scan&scroll=1m [status:200 request:0.010s]  
ERROR 2014-10-06 15:05:03,795 reports.py:123 Cannot generate report  
Traceback (most recent call last):  
File  
"/env/local/lib/python2.7/site-packages/elasticsearch/helpers/ **init**.py",  
line 176, in scan  
scroll\_id = resp['\_scroll\_id']  
KeyError: '\_scroll\_id'  
WARNING 2014-10-06 15:05:03,794  
/env/local/lib/python2.7/site-packages/elasticsearch/connection/base.py:76  
GET [http://192.168.0.1:9200/events/event/\_](http://192.168.0.1:9200/events/event/_)  
search?routing=123 [status:N/A request:0.012s]  
Traceback (most recent call last):  
File  
"/env/local/lib/python2.7/site-packages/elasticsearch/connection/http\_urllib3.py",  
line 46, in perform\_request  
response = self.pool.urlopen(method, url, body, retries=False,  
headers=headers, \*\*kw)  
File "/env/local/lib/python2.7/site-packages/urllib3/connectionpool.py",  
line 559, in urlopen  
\_pool=self, \_stacktrace=stacktrace)  
File "/env/local/lib/python2.7/site-packages/urllib3/util/retry.py", line  
223, in increment  
raise six.reraise(type(error), error, \_stacktrace)  
File "/env/local/lib/python2.7/site-packages/urllib3/connectionpool.py",  
line 516, in urlopen  
body=body, headers=headers)  
File "/env/local/lib/python2.7/site-packages/urllib3/connectionpool.py",  
line 354, in \_make\_request  
self, url, "Read timed out. (read timeout=%s)" % read\_timeout)  
ReadTimeoutError: HTTPConnectionPool(host=u'192.168.0.1', port=9200): Read  
timed out. (read timeout=10)

The timeout following the error is from different request but maybe it  
helps to understand the problem that's why I pasted it too.

I'm using py-elasticsearch 1.2.0 and I have two Elasticsearch servers both  
at version 1.3.2 of elasticsearch.

Thanks in advance!

On Tuesday, October 7, 2014 4:25:09 AM UTC-3, Honza Král wrote:

> Hi Bruno,
> 
> this definitely shouldn't be happening. Could you turn on your logging  
> for the python library to see what's going on? Just enabling the  
> `elasticsearch` logger in python logging module should do the trick.
> 
> Thanks!
> 
> On Mon, Oct 6, 2014 at 7:21 PM, Bruno Ribeiro da Silva  
> \<[bruno....@gmail.com](mailto:bruno....@gmail.com) \<javascript:\>\> wrote:
> 
> > Hi Everyone!
> > 
> > I'm using ES for 6 months in production and today I was caught by an  
> > error  
> > being thrown by helpers.scan() method, what I could see is that scan  
> > always  
> > expect the response to contain the key \_scroll\_id, so I'm trying to  
> > understand it it's a problem in python wrappers or a problem in my ES  
> > servers that didn't respond correctly to the request.
> > 
> > Any recommendations?
> > 
> > Thanks!
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/6e56b021-4193-4152-82fc-df570229cbcf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6e56b021-4193-4152-82fc-df570229cbcf%40googlegroups.com).
> 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/70acdf5d-186e-4003-bc4d-e8972a885435%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/70acdf5d-186e-4003-bc4d-e8972a885435%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:57am UTC](https://discuss.elastic.co/t/keyerror-using-python-helpers-scan/20096/4 "2017-07-06T00:57:51Z")

</div>


