Match all query not working elastic search

I am writing a python program to get the data from the elastic search indices. I want to get the data based on the match query which i indicated is upto 25. I want the first 25 data's. The data's in my index is 10842. But it retrieves all the data from the index of the elastic search. I checked solution from here matchall query for es but it doesn't helped me. Help me with some solutions

Here's the code:

from elasticsearch import Elasticsearch
import elasticsearch.helpers

count = 0
host = 'localhost'
ind = 'apps'
doc_typ = "change_apps"
limit_count = 25

def elasticsearch_import(host,ind,doc_typ,count,limit_count,port=9200,query={},single_line=False,single_line_label="message"):
    print("Data to be get from Elastic Search: ",data_count)
    es = Elasticsearch()
    results = elasticsearch.helpers.scan(es,
    query={"query": {"match_all": {}},"from":count,"size":data_count})
    for i in results:
    print("Data got from Elastic Search",len(res))

Output i got:

Data to be get from Elastic Search:  25
Data got from Elastic Search 10842

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