Java query - group Max return a child array field

I have a nested data model:
country: id
region: id
time: 1999L
contentList: // can have 20000-50000 items

Filter by country id and get the document with the max time for each unique region. Then slice the contentList (top 1000 items with the highest scores)

Finally put all the list items together and sort again by score to return top 1000 items.

Yes it’s complicated logic.

Someone who has a good solution in Java ?

Thank you :slight_smile

The conversation continues in another thread for those who are intrested: