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

Limit ES results count to 10000

parent 71a97593
No related branches found
No related tags found
No related merge requests found
......@@ -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