setFilter($filter); } } /** * Set the filter for this aggregation. * * @param AbstractFilter $filter * * @return $this */ public function setFilter(AbstractFilter $filter) { return $this->setParam('filter', $filter->toArray()); } /** * @return array */ public function toArray() { $array = array( 'filter' => $this->getParam('filter'), ); if ($this->_aggs) { $array['aggs'] = $this->_aggs; } return $array; } }