Recommendations in Elasticsearch
There is a product database; the popularity value for products is periodically calculated. An index has been built in ES, there is sorting by popularity value.
There is a task to screw up a recommendation system. The recommendation system for each user_id produces N recommended products with a recommendation value from 0 to 1.
It is required to display products for each user in this way: first those with popularity >A (top products) sorted by popularity, then recommended for the user (sorted), then all the rest sorted by popularity.
How can this sorting be implemented at the ES level? How to put user recommendations there?