This might be simple, but unable to find a way. I am trying to find max revision of each entity less than or equal to given revision number.
AuditQuery query
I think what you are looking for the AuditEntitry.revisionNumber.max() constraint. This should maximize the revision number satisfying the nested constraints.
AuditEntitry.revisionNumber.max()
See also the documentation on that matter.