Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException when 'from' or 'size' is too large #7774

thihy opened this Issue Sep 18, 2014 · 2 comments


None yet
3 participants
Copy link

commented Sep 18, 2014

For request:

 {"sort":{"_uid":"asc"},"from":2147483647,"size":10, "query":{"query_string":{"query":"*:*"}}}

Failed with a IllegalArgumentException:

IllegalArgumentException[numHits must be > 0; please use TotalHitCountCollector if you just need the total hit count]; }]

@martijnvg martijnvg self-assigned this Sep 18, 2014


This comment has been minimized.

Copy link

commented Sep 18, 2014

@thihy This is very large from value and usage like this can lead to heap memory performance issues. ES would need to create a priority queue of size from + size of each shard for sorting purposes. Actually in this case we can't event create a priority queue, because from + size is larger then Integer.MAX_VALUE.

What is the reason for the high from usage? If you want to retrieve all the documents from ES in a particular order then I suggest you use the scroll api. This doesn't create a priority query of size from + size, but just a size equal to size. See for more information:

The error message is cryptic and we should fail requests like this in a better and more descriptive way.


This comment has been minimized.

Copy link

commented Sep 25, 2014

Closed by #7778

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.