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

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]')

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