public function toArray()
{
$array = parent::toArray();
if (array_key_exists('global_aggregation', $array)) {
// compensate for class name GlobalAggregation
$array = ['global' => new \stdClass()];
}
if (sizeof($this->_aggs)) {
$array['aggs'] = $this->_convertArrayable($this->_aggs);
}
return $array;
}