diff --git a/src/Aggregation/Ipv4RangeAggregation.php b/src/Aggregation/Ipv4RangeAggregation.php
index 917c7a8e23c2e95c9f6cf0da6492bce29c26caf5..9b486b7e83524296a868e1f6373f6069a4fa0c3c 100644
--- a/src/Aggregation/Ipv4RangeAggregation.php
+++ b/src/Aggregation/Ipv4RangeAggregation.php
@@ -25,6 +25,29 @@ class Ipv4RangeAggregation extends AbstractAggregation
      */
     private $ranges = [];
 
+    /**
+     * Inner aggregations container init.
+     *
+     * @param string $name
+     * @param string $field
+     * @param array  $ranges
+     */
+    public function __construct($name, $field = null, $ranges = [])
+    {
+        parent::__construct($name);
+
+        $this->setField($field);
+        foreach ($ranges as $range) {
+            if (is_array($range)) {
+                $from = isset($range['from']) ? $range['from'] : null;
+                $to = isset($range['to']) ? $range['to'] : null;
+                $this->addRange($from, $to);
+            } else {
+                $this->addMask($range);
+            }
+        }
+    }
+
     /**
      * Add range to aggregation.
      *
diff --git a/tests/Aggregation/Ipv4RangeAggregationTest.php b/tests/Aggregation/Ipv4RangeAggregationTest.php
index eb3a27eccdfae5c950c57f48d816c374c1be69e7..7542584b5e035a454026dfc9d5450ef719af75cf 100644
--- a/tests/Aggregation/Ipv4RangeAggregationTest.php
+++ b/tests/Aggregation/Ipv4RangeAggregationTest.php
@@ -25,4 +25,36 @@ class Ipv4RangeAggregationTest extends \PHPUnit_Framework_TestCase
         $agg = new Ipv4RangeAggregation('foo');
         $agg->toArray();
     }
+
+    /**
+     * Tests if field and range  can be passed to constructor.
+     */
+    public function testConstructorFilter()
+    {
+        $aggregation = new Ipv4RangeAggregation('test', 'fieldName', [['from' => 'fromValue']]);
+        $this->assertSame(
+            [
+                'agg_test' => [
+                    'ip_range' => [
+                        'field' => 'fieldName',
+                        'ranges' => [['from' => 'fromValue']],
+                    ],
+                ],
+            ],
+            $aggregation->toArray()
+        );
+
+        $aggregation = new Ipv4RangeAggregation('test', 'fieldName', ['maskValue']);
+        $this->assertSame(
+            [
+                'agg_test' => [
+                    'ip_range' => [
+                        'field' => 'fieldName',
+                        'ranges' => [['mask' => 'maskValue']],
+                    ],
+                ],
+            ],
+            $aggregation->toArray()
+        );
+    }
 }