Size of data to get: 20,000 approx
Issue: searching Elastic Search indexed data using below command in python
but not getting any results back.
from pyelasticsearch import ElasticSearch
es_repo = ElasticSearch(settings.ES_INDEX_URL)
search_results = es_repo.search(
query, index=advertiser_name, es_from=_from, size=_size)
If I give size less than or equal to 10,000 it works fine but not with 20,000 Please help me find an optimal solution to this.
PS: On digging deeper into ES found this message error:
Result window is too large, from + size must be less than or equal to: [10000] but was [19999]. See the scrolling API for a more efficient way to request large data sets.
Probably its ElasticSearch constraints.
for real time use the best solution is to use the search after query . You need only a date field, and another field that uniquely identify a doc - it's enough a
_id
field or an_uid
field. Try something like this, in my example I would like to extract all the documents that belongs to a single user - in my example the user field has akeyword datatype
:Then you will find all the doc appended to the
result
varIf you would like to use
scroll query
- doc here: