Aggregation sort by timestamp

Hi, I am trying to make a sort by timestamp.

{
"sort" :[{"timestamp":{"order":"asc"}}],
"size":0,
"aggs":{
"people":{
"terms":
{"field":"B2Bunit"},
"aggs": {
"products": {
"terms": {
"field": "code"
}
}
}
}
}
}
the problem is that the aggregation force a new sort by doc_count.
and if i want to use the order option in the aggregation, the timestamp field is not recognized.

the field timestamp belongs the main document.

Thank you!