Skip to content

Conversation

@odolbeau
Copy link

@odolbeau odolbeau commented Oct 2, 2016

With recent ES version, we have en exception when size + offset > 10000.
BTW it's possible to override this directly in ES configuration even if it's not recommended.

With this new constructor argument, it's possible to limit the number of results even if the dataset contains more results.
In this case, we won't display pages where size + offset > 10000 and we won't have this error:

 * [2016-09-24 12:20:12] request.CRITICAL: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Result window is too large, from + size must be less than or equal to: [10000] but was [33920]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level parameter. [reason: all shards failed]") in "***" at line X."

@sampart
Copy link
Collaborator

sampart commented May 1, 2018

Thank for this, @odolbeau. I'm sorry there's been no activity from us here. Please could you add something to the Elastica section in the README explaining this new option? This will then be good to merge, I think.

@odolbeau odolbeau force-pushed the limit-es-results branch from 28c49da to b4a5448 Compare May 17, 2018 08:49
@odolbeau
Copy link
Author

PR rebased! 👍

Copy link
Collaborator

@sampart sampart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Just one last change.


*Be careful when paginating a huge set of documents. By default, offset + limit
can't exceed 10000. For more information, see:
[#213](https://github.com/whiteoctober/Pagerfanta/pull/213#issue-87631892).*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an additional sentence saying something like "You can mitigate this by setting the $maxResults parameter when constructing the ElasticaAdapter"? Thanks

@odolbeau odolbeau force-pushed the limit-es-results branch from b4a5448 to cb95185 Compare May 17, 2018 09:06
@odolbeau
Copy link
Author

Done

Copy link
Collaborator

@sampart sampart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks.

@sampart
Copy link
Collaborator

sampart commented May 17, 2018

I'll merge once tests have passed.

@sampart sampart merged commit 15770d9 into whiteoctober:master May 17, 2018
@sampart
Copy link
Collaborator

sampart commented May 17, 2018

I've created release https://github.com/whiteoctober/Pagerfanta/releases/tag/v2.0.1 for this. Thanks again for your input.

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 this pull request may close these issues.

2 participants