If we want to get the unique value in results based on certain field than we can do a collapse on the field and Get the result based on the sort we provide.
let say I want to fetch X number of results, for those what I need is 1. Get all the unique values 2. If records are less than X, then fetch extra records to complete the required amount X.