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;
}
/** * @throws InvalidException If buckets path is not set * * @return array */ public function toArray() { if (!$this->hasParam('buckets_path')) { throw new InvalidException('Buckets path is required'); } return parent::toArray(); }