Apache tinkerpop gremlin query with limits question
23:44 22 Dec 2025

I'm trying to use Gremlin, but has no idea how to use the following sub-task:

I have vertices like with description, startDate and groupId and I need to find first 10 vertices by startDate, but no more than 3 in each group id. It means if I have incoming order by start date like {id, groupId}:

{1,1},{2,2},{3,1},{4,1},{5,1},{6,2},{7,1},{8,2}

I would have two buckets with ids: 1,3,4 and 2,6,8.

I know about group by possibilities and limit in groups, but in this case I need somehow to skip items when no room in the corresponding bucket and preserve order by start date to avoid get older items.

apache gremlin tinkerpop