From 4cb359d8c90d992b39f316a8439f197c19f67afb Mon Sep 17 00:00:00 2001
From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io>
Date: Thu, 9 Jul 2015 16:01:22 +0300
Subject: [PATCH] Add constructor arguments to TermsAggregation.

---
 src/Aggregation/TermsAggregation.php | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/Aggregation/TermsAggregation.php b/src/Aggregation/TermsAggregation.php
index 3726089..2b65ec1 100644
--- a/src/Aggregation/TermsAggregation.php
+++ b/src/Aggregation/TermsAggregation.php
@@ -22,6 +22,21 @@ class TermsAggregation extends AbstractAggregation
     use BucketingTrait;
     use ScriptAwareTrait;
 
+    /**
+     * Inner aggregations container init.
+     *
+     * @param string $name
+     * @param string $field
+     * @param string $script
+     */
+    public function __construct($name, $field = null, $script = null)
+    {
+        parent::__construct($name);
+
+        $this->setField($field);
+        $this->setScript($script);
+    }
+
     /**
      * {@inheritdoc}
      */
-- 
GitLab