add an option to write the aggregation type in the response