Limit the Elasticsearch results count in Rails
I had the same Issue, in my case I'm using kaminari
but should work the same with will_paginate
:
= paginate @keyword_search_results
With 25 results per page after 400 page it throws the index.max_result_window
error, so I just add the :total_pages
option to paginate
= paginate @keyword_search_results, {:total_pages => 400}
Would be a good idea to calculate that value dynamically based on your needs.
use per_page option
@response = Price.search(params, per_page: 24)