# Error appeared while trying to get all documents from an index one by one

**URL:** <https://discuss.elastic.co/t/error-appeared-while-trying-to-get-all-documents-from-an-index-one-by-one/221964>\
**Category:** Elasticsearch\
**Created:** [March 4, 2020, 2:05am UTC](https://discuss.elastic.co/t/error-appeared-while-trying-to-get-all-documents-from-an-index-one-by-one/221964 "2020-03-04T02:05:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aayush\_Lakkad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aayush_lakkad/32/63740_2.png) [@Aayush\_Lakkad](https://discuss.elastic.co/u/Aayush_Lakkad)\
**Post date:** [March 4, 2020, 2:05am UTC](https://discuss.elastic.co/t/error-appeared-while-trying-to-get-all-documents-from-an-index-one-by-one/221964/1 "2020-03-04T02:05:42Z")

</div>

Hey,  
I am new to elasticsearch and was trying a piece of code to get all the documents from an index one by one but I got an error.  
The code was:  
\> from elasticsearch import Elasticsearch  
\> import pandas as pd  
\> es = Elasticsearch([{'host':'localhost', 'port':9200}])  
\> n=0  
\> while n \<=3:  
\> doc = {'size' : 1, 'query' : {'match all' : {}}}  
\> res = es.search(index = 'kibana\_sample\_data\_flights', doc\_type = "doc", body = doc, scroll = '1m')  
\> scroll = res['\_scroll\_id']  
\> res2 = es.scroll(scroll\_id = scroll, scroll = '1m')  
\> print("res", res)  
\> print('res2', res2)  
\> n += 1

The error I am getting is:  
Traceback (most recent call last):  
File "C:\Users\HP\Desktop\es\sample\_es1.py", line 19, in   
res = es.search(index = 'kibana\_sample\_data\_flights', doc\_type = "doc", body = doc, scroll = '1m')  
File "C:\Program Files\Python37\lib\site-packages\elasticsearch\client\utils.py", line 84, in _wrapped  
return func(\*args, params=params, \*\*kwargs)  
File "C:\Program Files\Python37\lib\site-packages\elasticsearch\client\_init_.py", line 1548, in search  
"GET", \_make\_path(index, doc\_type, "\_search"), params=params, body=body  
File "C:\Program Files\Python37\lib\site-packages\elasticsearch\transport.py", line 358, in perform\_request  
timeout=timeout,  
File "C:\Program Files\Python37\lib\site-packages\elasticsearch\connection\http\_urllib3.py", line 261, in perform\_request  
self.\_raise\_error(response.status, raw\_data)  
File "C:\Program Files\Python37\lib\site-packages\elasticsearch\connection\base.py", line 182, in \_raise\_error  
status\_code, error\_message, additional\_info  
elasticsearch.exceptions.RequestError: RequestError(400, 'parsing\_exception', 'no [query] registered for [match all]')

---

<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:** [April 1, 2020, 2:05am UTC](https://discuss.elastic.co/t/error-appeared-while-trying-to-get-all-documents-from-an-index-one-by-one/221964/2 "2020-04-01T02:05:50Z")

</div>

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