I'm running Rails with Elasticsearch using the elasticsearch-rails and will_paginate gems and things are working great.
The only problem I'm having is that my records count has grown over 10.000 which gives the error "Result window is too large, from + size must be less than or equal to: [10000] but was [10200]" when someone clicks on the last page of the pagination links.
Now I don't want to mess with index.max_result_window because my dataset is going be much much larger and I really don't need visitors to be able to view every page and record anyway.
So basically I just want to set a limit of 10.000 on my results but I'm having no luck getting that working.
This is the query I have in my controller action:
@response = Price.search(params)
@response = @response.paginate(page: params[:page], per_page: 24)
@prices = @response.records.includes(shop: :pictures)
@prices_count = @response.total_entries
@prices = @prices.decorate
@results = @response.results
And I feed the @response to will_paginate using
will_paginate(@response)
I've tried using .limit(10000) in various places and giving a total_entries value to will_paginate but nothing seems to work.
Do you guys have any ideas?
Thanks!