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

Closed
thihy opened this issue Sep 18, 2014 · 2 comments · Fixed by #7778
Closed

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

thihy opened this issue Sep 18, 2014 · 2 comments · Fixed by #7778
Assignees

Comments

@thihy
Copy link

thihy 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
@martijnvg
Copy link
Member

@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: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-scroll.html#search-request-scroll

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

@clintongormley
Copy link

Closed by #7778

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants