Skip to content
Snippets Groups Projects
Commit 4809a98e authored by Erwan Rouchet's avatar Erwan Rouchet
Browse files

Limit ES results count to 10000

parent 2edf8f65
No related branches found
No related tags found
1 merge request!92Limit ES results count to 10000
......@@ -34,7 +34,7 @@ class ESQuerySet(object):
index=self.es_index,
body={
"from": value.start,
"size": value.stop - value.start,
"size": min(value.stop - value.start, 10000), # The Scroll API is required to go over 10K results
"_source": self._source,
"query": self.query,
"aggs": self.aggs,
......@@ -48,13 +48,13 @@ class ESQuerySet(object):
return self.count()
def count(self):
return self.elastic.count(
return min(self.elastic.count(
index=self.es_index,
body={
"query": self.query,
},
doc_type=self.es_type,
)['count']
)['count'], 10000) # The Scroll API is required to go over 10K results
def __iter__(self):
return self[0:len(self)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment