public function toArray()
{
$array = parent::toArray();
// if there are no params, it's ok, but ES will throw exception if json
// will be like {"top_hits":[]} instead of {"top_hits":{}}
if (empty($array['top_hits'])) {
$array['top_hits'] = new \stdClass();
}
return $array;
}