Add group by for index