Added aggregation support to the percolate api.
Closes #4245