Added aggregation support to the percolate api.

Relates #4245