Distinct doc values by custom

We are asking for help on applying ES to our application.

The data values of our field:GroupID are not distinct.
We want to pick up the document which has the highest rank among the documents that have the same GroupID.

In order to achieve this, we tried to use the Cardinality Aggregation method.
However, the method neither can sort nor can scroll pages.

How can we achieve the goal of sorting and scrolling pages among the documents which are chosen from duplicate doc values by custom?

Any suggestions would be appreciated.

Thanks in advance!

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