How to custom sort

Hello.
I'm building a retail search.
This search needs to give priority to products from certain stores (they pay to be more relevant).
The roducts from these stores need to appear more frequently in the search.

I'm using script_score to detect if the store is a "paid store". So I can give a higher score for products from this store.

The problem is that a store (with relevance payement) can have more than 100,000 products
and the way I did, the first search pages (pagination) are only flooded with products from the store (with increased score).

Is there a way to balance these products?
i.e. bring products from paying stores mixed with products from non-paying stores and have a more balanced results page

Welcome to our community! :smiley:

What about something like Random sampler aggregation | Elasticsearch Guide [8.3] | Elastic?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.