From 6e2658440795b764e31d52dec0f13647de934719 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mantas=20Jonu=C5=A1as?= <mantas.jonusas@nfq.lt>
Date: Thu, 9 Apr 2015 09:55:13 +0300
Subject: [PATCH] Added additional check for sort parameter in top hits
 aggregation

---
 Aggregation/TopHitsAggregation.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Aggregation/TopHitsAggregation.php b/Aggregation/TopHitsAggregation.php
index 0dc099e..17ad36e 100644
--- a/Aggregation/TopHitsAggregation.php
+++ b/Aggregation/TopHitsAggregation.php
@@ -49,7 +49,9 @@ class TopHitsAggregation extends AbstractAggregation
         parent::__construct($name);
         $this->setFrom($from);
         $this->setSize($size);
-        $this->setSort($sort);
+        if (!empty($sort)) {
+            $this->setSort($sort);
+        }
     }
 
     /**
-- 
GitLab