diff --git a/.travis.yml b/.travis.yml
index 9a0196d1164e26a24793237db1bee21b084cc1e8..624f94cbb36a4c2908e966a86174e8b276399da7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,7 @@ before_script:
   - composer install --no-interaction --prefer-dist
 script:
   - vendor/bin/phpunit --coverage-clover=coverage.clover
-  - vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/ ./
+  - vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/,src/Filter/ ./
 after_script:
   - vendor/bin/coveralls
 notifications:
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..d843e4c666951bc3569f9719b9fa831bf280433c
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,16 @@
+CHANGELOG
+=========
+
+v1.x (201x)
+---
+
+- Fixed nested query in case `bool` with single `must` clause given (#32)
+- Deprecated all filters and filtered query (#50)
+- Added `filter` clause support for `BoolQuery` (#48)
+
+v1.0.1 (2015-12-16)
+---
+               
+- Fixed `function_score` query options handling (#35)
+- Added Symfony 3 compatibility
+- Added support for `timeout` and `terminate_after` options in Search endpoint (#34)
diff --git a/docs/Filter/Or.md b/docs/Filter/Or.md
index 7c8ef3c7ecf57009a0b9a57eedccf533231f94e0..34a666afa81e5c7033a0cbf43aa39f1522200755 100644
--- a/docs/Filter/Or.md
+++ b/docs/Filter/Or.md
@@ -1,5 +1,7 @@
 # Or Filter
 
+__DEPRECATED:__ `OrFilter` is deprecated and will be removed in 2.0. Use `BoolQuery` instead.
+
 > More info about or filter is in the [official elasticsearch docs][1]
 
 A filter that matches documents using the OR boolean operator on other filters.
diff --git a/src/Filter/AndFilter.php b/src/Filter/AndFilter.php
index 7c4ac592e5c987d03be84319b73b973be749fcee..3be326c2726a8c05b44876583a610d76f402fd39 100644
--- a/src/Filter/AndFilter.php
+++ b/src/Filter/AndFilter.php
@@ -11,6 +11,11 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
+@trigger_error(
+    'The AndFilter class is deprecated and will be removed in 2.0. Use BoolQuery instead.',
+    E_USER_DEPRECATED
+);
+
 use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
@@ -18,6 +23,8 @@ use ONGR\ElasticsearchDSL\ParametersTrait;
  * Represents Elasticsearch "and" filter.
  *
  * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-and-filter.html
+ *
+ * @deprecated Will be removed in 2.0. Use the BoolQuery instead.
  */
 class AndFilter implements BuilderInterface
 {
diff --git a/src/Filter/BoolFilter.php b/src/Filter/BoolFilter.php
index caf079b0e4ffa2461b8ead6ae62f8e21679b3dcc..a3699a0d599f64eb642c0982fc996b99b6841a65 100644
--- a/src/Filter/BoolFilter.php
+++ b/src/Filter/BoolFilter.php
@@ -11,12 +11,19 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
+@trigger_error(
+    'The BoolFilter class is deprecated and will be removed in 2.0. Use BoolQuery instead.',
+    E_USER_DEPRECATED
+);
+
 use ONGR\ElasticsearchDSL\Query\BoolQuery;
 
 /**
  * Represents Elasticsearch "bool" filter.
  *
  * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-filter.html
+ *
+ * @deprecated Will be removed in 2.0. Use the BoolQuery instead.
  */
 class BoolFilter extends BoolQuery
 {
diff --git a/src/Filter/ExistsFilter.php b/src/Filter/ExistsFilter.php
index 2c60b137a99b526f5f7a60887e77527cd0a1a9ac..31f48949bc8805ccefe77edf8a22ffbdee44cb2c 100644
--- a/src/Filter/ExistsFilter.php
+++ b/src/Filter/ExistsFilter.php
@@ -11,43 +11,20 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
+@trigger_error(
+    'The ExistsFilter class is deprecated and will be removed in 2.0. Use ExistsQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\ExistsQuery;
 
 /**
  * Represents Elasticsearch "exists" filter.
  *
  * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-exists-filter.html
+ *
+ * @deprecated Will be removed in 2.0. Use the ExistsQuery instead.
  */
-class ExistsFilter implements BuilderInterface
+class ExistsFilter extends ExistsQuery
 {
-    /**
-     * @var string
-     */
-    private $field;
-
-    /**
-     * @param string $field Field value.
-     */
-    public function __construct($field)
-    {
-        $this->field = $field;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'exists';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        return [
-            'field' => $this->field,
-        ];
-    }
 }
diff --git a/src/Filter/GeoBoundingBoxFilter.php b/src/Filter/GeoBoundingBoxFilter.php
index 22fb5a31f95a4fdfb3269cdab6805f5a4de6ff69..1aacf8b4a052958bde60c89ca63b3ddc40b0fdb4 100644
--- a/src/Filter/GeoBoundingBoxFilter.php
+++ b/src/Filter/GeoBoundingBoxFilter.php
@@ -11,73 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The GeoBoundingBoxFilter class is deprecated and will be removed in 2.0. Use GeoBoundingBoxQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\GeoBoundingBoxQuery;
 
 /**
  * Represents Elasticsearch "Geo Bounding Box" filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the GeoBoundingBoxQuery instead.
  */
-class GeoBoundingBoxFilter implements BuilderInterface
+class GeoBoundingBoxFilter extends GeoBoundingBoxQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var array
-     */
-    private $values;
-
-    /**
-     * @var string
-     */
-    private $field;
-
-    /**
-     * @param string $field
-     * @param array  $values
-     * @param array  $parameters
-     */
-    public function __construct($field, $values, array $parameters = [])
-    {
-        $this->field = $field;
-        $this->values = $values;
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'geo_bounding_box';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        if (count($this->values) === 2) {
-            $query = [
-                $this->field => [
-                    'top_left' => $this->values[0],
-                    'bottom_right' => $this->values[1],
-                ],
-            ];
-        } elseif (count($this->values) === 4) {
-            $query = [
-                $this->field => [
-                    'top' => $this->values[0],
-                    'left' => $this->values[1],
-                    'bottom' => $this->values[2],
-                    'right' => $this->values[3],
-                ],
-            ];
-        } else {
-            throw new \LogicException('Geo Bounding Box filter must have 2 or 4 geo points set.');
-        }
-
-        $output = $this->processArray($query);
-
-        return $output;
-    }
 }
diff --git a/src/Filter/GeoDistanceFilter.php b/src/Filter/GeoDistanceFilter.php
index 73469185af0f62d3b6586a385aaf30e410740b5e..0de010f27e77f8433f1cdeadb1c47e9c613158ae 100644
--- a/src/Filter/GeoDistanceFilter.php
+++ b/src/Filter/GeoDistanceFilter.php
@@ -11,65 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The GeoDistanceFilter class is deprecated and will be removed in 2.0. Use GeoDistanceQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\GeoDistanceQuery;
 
 /**
  * Represents Elasticsearch "Geo Distance Filter" filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the GeoDistanceQuery instead.
  */
-class GeoDistanceFilter implements BuilderInterface
+class GeoDistanceFilter extends GeoDistanceQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var string
-     */
-    private $field;
-
-    /**
-     * @var string
-     */
-    private $distance;
-
-    /**
-     * @var mixed
-     */
-    private $location;
-
-    /**
-     * @param string $field
-     * @param string $distance
-     * @param mixed  $location
-     * @param array  $parameters
-     */
-    public function __construct($field, $distance, $location, array $parameters = [])
-    {
-        $this->field = $field;
-        $this->distance = $distance;
-        $this->location = $location;
-
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'geo_distance';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        $query = [
-            'distance' => $this->distance,
-            $this->field => $this->location,
-        ];
-        $output = $this->processArray($query);
-
-        return $output;
-    }
 }
diff --git a/src/Filter/GeoDistanceRangeFilter.php b/src/Filter/GeoDistanceRangeFilter.php
index ba433ab926684289d29b740f3e2baa852eda5b2d..44a24f9a5a25ba12725c102133dd74a0b7a0a20c 100644
--- a/src/Filter/GeoDistanceRangeFilter.php
+++ b/src/Filter/GeoDistanceRangeFilter.php
@@ -11,62 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The GeoDistanceRangeFilter class is deprecated and will be removed in 2.0. Use GeoDistanceRangeQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\GeoDistanceRangeQuery;
 
 /**
  * Represents Elasticsearch "Geo Distance Range Filter" filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the GeoDistanceRangeQuery instead.
  */
-class GeoDistanceRangeFilter implements BuilderInterface
+class GeoDistanceRangeFilter extends GeoDistanceRangeQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var string
-     */
-    private $field;
-
-    /**
-     * @var array
-     */
-    private $range;
-
-    /**
-     * @var mixed
-     */
-    private $location;
-
-    /**
-     * @param string $field
-     * @param array  $range
-     * @param mixed  $location
-     * @param array  $parameters
-     */
-    public function __construct($field, $range, $location, array $parameters = [])
-    {
-        $this->field = $field;
-        $this->range = $range;
-        $this->location = $location;
-
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'geo_distance_range';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        $query = $this->range + [$this->field => $this->location];
-        $output = $this->processArray($query);
-
-        return $output;
-    }
 }
diff --git a/src/Filter/GeoPolygonFilter.php b/src/Filter/GeoPolygonFilter.php
index 541f3955b41f950afcc22b1c99bf0cf111e3468b..3340aea5d3bca6eac437d88f814d8e9b86637129 100644
--- a/src/Filter/GeoPolygonFilter.php
+++ b/src/Filter/GeoPolygonFilter.php
@@ -11,55 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The GeoPolygonFilter class is deprecated and will be removed in 2.0. Use GeoPolygonQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\GeoPolygonQuery;
 
 /**
  * Elasticsearch geo polygon filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the GeoPolygonQuery instead.
  */
-class GeoPolygonFilter implements BuilderInterface
+class GeoPolygonFilter extends GeoPolygonQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var string
-     */
-    private $field;
-
-    /**
-     * @var array
-     */
-    private $points;
-
-    /**
-     * @param string $field
-     * @param array  $points
-     * @param array  $parameters
-     */
-    public function __construct($field, array $points = [], array $parameters = [])
-    {
-        $this->field = $field;
-        $this->points = $points;
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'geo_polygon';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        $query = [];
-        $query[$this->field] = ['points' => $this->points];
-        $output = $this->processArray($query);
-
-        return $output;
-    }
 }
diff --git a/src/Filter/GeoShapeFilter.php b/src/Filter/GeoShapeFilter.php
index 0c83b816fe1d1497a92f85855659f0e6a1f15877..d783268f54393623e96801fb1c10bc93c7396d78 100644
--- a/src/Filter/GeoShapeFilter.php
+++ b/src/Filter/GeoShapeFilter.php
@@ -11,90 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The GeoShapeFilter class is deprecated and will be removed in 2.0. Use GeoShapeQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\GeoShapeQuery;
 
 /**
  * Elasticsearch geo-shape filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the GeoShapeQuery instead.
  */
-class GeoShapeFilter implements BuilderInterface
+class GeoShapeFilter extends GeoShapeQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var array
-     */
-    private $fields = [];
-
-    /**
-     * @param array $parameters
-     */
-    public function __construct(array $parameters = [])
-    {
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'geo_shape';
-    }
-
-    /**
-     * Add geo-shape provided filter.
-     *
-     * @param string $field       Field name.
-     * @param string $type        Shape type.
-     * @param array  $coordinates Shape coordinates.
-     * @param array  $parameters  Additional parameters.
-     */
-    public function addShape($field, $type, array $coordinates, array $parameters = [])
-    {
-        $filter = array_merge(
-            $parameters,
-            [
-                'type' => $type,
-                'coordinates' => $coordinates,
-            ]
-        );
-
-        $this->fields[$field]['shape'] = $filter;
-    }
-
-    /**
-     * Add geo-shape pre-indexed filter.
-     *
-     * @param string $field      Field name.
-     * @param string $id         The ID of the document that containing the pre-indexed shape.
-     * @param string $type       Name of the index where the pre-indexed shape is.
-     * @param string $index      Index type where the pre-indexed shape is.
-     * @param string $path       The field specified as path containing the pre-indexed shape.
-     * @param array  $parameters Additional parameters.
-     */
-    public function addPreIndexedShape($field, $id, $type, $index, $path, array $parameters = [])
-    {
-        $filter = array_merge(
-            $parameters,
-            [
-                'id' => $id,
-                'type' => $type,
-                'index' => $index,
-                'path' => $path,
-            ]
-        );
-
-        $this->fields[$field]['indexed_shape'] = $filter;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        $output = $this->processArray($this->fields);
-
-        return $output;
-    }
 }
diff --git a/src/Filter/GeohashCellFilter.php b/src/Filter/GeohashCellFilter.php
index 993420c7a341e3b83b5ce918a662f61abb7f8b9b..768f02b3022a6f2f8431030a88198a3433455058 100644
--- a/src/Filter/GeohashCellFilter.php
+++ b/src/Filter/GeohashCellFilter.php
@@ -11,56 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The GeohashCellFilter class is deprecated and will be removed in 2.0. Use GeohashCellQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\GeohashCellQuery;
 
 /**
  * Represents Elasticsearch "Geohash Cell" filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the GeohashCellQuery instead.
  */
-class GeohashCellFilter implements BuilderInterface
+class GeohashCellFilter extends GeohashCellQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var string
-     */
-    private $field;
-
-    /**
-     * @var mixed
-     */
-    private $location;
-
-    /**
-     * @param string $field
-     * @param mixed  $location
-     * @param array  $parameters
-     */
-    public function __construct($field, $location, array $parameters = [])
-    {
-        $this->field = $field;
-        $this->location = $location;
-
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'geohash_cell';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        $query = [];
-        $query[$this->field] = $this->location;
-        $output = $this->processArray($query);
-
-        return $output;
-    }
 }
diff --git a/src/Filter/HasChildFilter.php b/src/Filter/HasChildFilter.php
index 4f0c585d46d3c734eded66e19d43662fbbe84a07..de79c658bb24e316e0d5cc46fe8861324a08ea25 100644
--- a/src/Filter/HasChildFilter.php
+++ b/src/Filter/HasChildFilter.php
@@ -11,49 +11,32 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
+@trigger_error(
+    'The HasChildFilter class is deprecated and will be removed in 2.0. Use HasChildQuery instead.',
+    E_USER_DEPRECATED
+);
+
 use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\DslTypeAwareTrait;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+use ONGR\ElasticsearchDSL\Query\HasChildQuery;
 
 /**
  * Elasticsearch has_child filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the BoolQuery instead.
  */
-class HasChildFilter implements BuilderInterface
+class HasChildFilter extends HasChildQuery
 {
-    use ParametersTrait;
     use DslTypeAwareTrait;
 
     /**
-     * @var string
-     */
-    private $type;
-
-    /**
-     * @var BuilderInterface
-     */
-    private $query;
-
-    /**
-     * @param string           $type
-     * @param BuilderInterface $query
-     * @param array            $parameters
-     *
-     * @throws \InvalidArgumentException
+     * {@inheritdoc}
      */
     public function __construct($type, BuilderInterface $query, array $parameters = [])
     {
-        $this->type = $type;
-        $this->query = $query;
-        $this->setParameters($parameters);
         $this->setDslType('filter');
-    }
 
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'has_child';
+        parent::__construct($type, $query, $parameters);
     }
 
     /**
@@ -61,13 +44,13 @@ class HasChildFilter implements BuilderInterface
      */
     public function toArray()
     {
-        $query = [
-            'type' => $this->type,
-            $this->getDslType() => [$this->query->getType() => $this->query->toArray()],
-        ];
+        $result = parent::toArray();
 
-        $output = $this->processArray($query);
+        if ($this->getDslType() !== 'query') {
+            $result[$this->getDslType()] = $result['query'];
+            unset($result['query']);
+        }
 
-        return $output;
+        return $result;
     }
 }
diff --git a/src/Filter/HasParentFilter.php b/src/Filter/HasParentFilter.php
index 5bb372d010b9667e4bc5f4c8a2a2b0b50339953a..90212bcee31f85debd3d538f0fd22965db18265e 100644
--- a/src/Filter/HasParentFilter.php
+++ b/src/Filter/HasParentFilter.php
@@ -11,49 +11,32 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
+@trigger_error(
+    'The HasParentFilter class is deprecated and will be removed in 2.0. Use HasParentQuery instead.',
+    E_USER_DEPRECATED
+);
+
 use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\DslTypeAwareTrait;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+use ONGR\ElasticsearchDSL\Query\HasParentQuery;
 
 /**
  * Elasticsearch has_parent filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the HasParentQuery instead.
  */
-class HasParentFilter implements BuilderInterface
+class HasParentFilter extends HasParentQuery
 {
-    use ParametersTrait;
     use DslTypeAwareTrait;
 
     /**
-     * @var string
-     */
-    private $parentType;
-
-    /**
-     * @var BuilderInterface
-     */
-    private $query;
-
-    /**
-     * @param string           $parentType
-     * @param BuilderInterface $query
-     * @param array            $parameters
-     *
-     * @throws \InvalidArgumentException
+     * {@inheritdoc}
      */
-    public function __construct($parentType, BuilderInterface $query, array $parameters = [])
+    public function __construct($type, BuilderInterface $query, array $parameters = [])
     {
-        $this->parentType = $parentType;
-        $this->query = $query;
-        $this->setParameters($parameters);
         $this->setDslType('filter');
-    }
 
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'has_parent';
+        parent::__construct($type, $query, $parameters);
     }
 
     /**
@@ -61,13 +44,13 @@ class HasParentFilter implements BuilderInterface
      */
     public function toArray()
     {
-        $query = [
-            'parent_type' => $this->parentType,
-            $this->getDslType() => [$this->query->getType() => $this->query->toArray()],
-        ];
+        $result = parent::toArray();
 
-        $output = $this->processArray($query);
+        if ($this->getDslType() !== 'query') {
+            $result[$this->getDslType()] = $result['query'];
+            unset($result['query']);
+        }
 
-        return $output;
+        return $result;
     }
 }
diff --git a/src/Filter/IdsFilter.php b/src/Filter/IdsFilter.php
index 4ceefa97f0c4479fa2631060ab05aa1356726ffb..64a195ebc30e279539153b0b20ea88188028c42e 100644
--- a/src/Filter/IdsFilter.php
+++ b/src/Filter/IdsFilter.php
@@ -11,49 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The IdsFilter class is deprecated and will be removed in 2.0. Use IdsQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\IdsQuery;
 
 /**
  * Represents Elasticsearch "ids" filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the IdsQuery instead.
  */
-class IdsFilter implements BuilderInterface
+class IdsFilter extends IdsQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var string[]
-     */
-    private $values;
-
-    /**
-     * @param string[] $values     Ids' values.
-     * @param array    $parameters Optional parameters.
-     */
-    public function __construct($values, array $parameters = [])
-    {
-        $this->values = $values;
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'ids';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        $query = [];
-        $query['values'] = $this->values;
-
-        $output = $this->processArray($query);
-
-        return $output;
-    }
 }
diff --git a/src/Filter/IndicesFilter.php b/src/Filter/IndicesFilter.php
index 0010552953c1378cd5170fa1f77b1717cf85b513..a2f829a3770938cfdad5b2f4e564a2816555740f 100644
--- a/src/Filter/IndicesFilter.php
+++ b/src/Filter/IndicesFilter.php
@@ -11,10 +11,17 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
+@trigger_error(
+    'The IndicesFilter class is deprecated and will be removed in 2.0. Use IndicesQuery instead.',
+    E_USER_DEPRECATED
+);
+
 use ONGR\ElasticsearchDSL\BuilderInterface;
 
 /**
  * Represents Elasticsearch "indices" filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the IndicesQuery instead.
  */
 class IndicesFilter implements BuilderInterface
 {
diff --git a/src/Filter/LimitFilter.php b/src/Filter/LimitFilter.php
index 18d254b522d25ea900bdb1c4b1170ed99851c781..b870f8acc171f5be14465d05243340ed56dd7e42 100644
--- a/src/Filter/LimitFilter.php
+++ b/src/Filter/LimitFilter.php
@@ -11,43 +11,20 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
+@trigger_error(
+    'The LimitFilter class is deprecated and will be removed in 2.0. Use LimitQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\LimitQuery;
 
 /**
  * Represents Elasticsearch "limit" filter.
  *
  * A limit filter limits the number of documents (per shard) to execute on.
+ *
+ * @deprecated Will be removed in 2.0. Use the LimitQuery instead.
  */
-class LimitFilter implements BuilderInterface
+class LimitFilter extends LimitQuery
 {
-    /**
-     * @var int
-     */
-    private $value;
-
-    /**
-     * @param int $value Number of documents (per shard) to execute on.
-     */
-    public function __construct($value)
-    {
-        $this->value = $value;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'limit';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        return [
-            'value' => $this->value,
-        ];
-    }
 }
diff --git a/src/Filter/MatchAllFilter.php b/src/Filter/MatchAllFilter.php
index 7674a014db58ddf333b678b25a920fc3b18fef03..30c15c27ca542ef1fc2ac33036dabf5fe5f428ae 100644
--- a/src/Filter/MatchAllFilter.php
+++ b/src/Filter/MatchAllFilter.php
@@ -11,28 +11,20 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
+@trigger_error(
+    'The MatchAllFilter class is deprecated and will be removed in 2.0. Use MatchAllQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
 
 /**
  * Represents Elasticsearch "match_all" filter.
  *
  * A filter matches on all documents.
+ *
+ * @deprecated Will be removed in 2.0. Use the MatchAllQuery instead.
  */
-class MatchAllFilter implements BuilderInterface
+class MatchAllFilter extends MatchAllQuery
 {
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'match_all';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        return [];
-    }
 }
diff --git a/src/Filter/MissingFilter.php b/src/Filter/MissingFilter.php
index 776a1bd28f3cdbf7b06eff87ee684cbbf8426531..a1102dd34593de49fe98b2e104a231b6335475cc 100644
--- a/src/Filter/MissingFilter.php
+++ b/src/Filter/MissingFilter.php
@@ -11,49 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The MissingFilter class is deprecated and will be removed in 2.0. Use MissingQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\MissingQuery;
 
 /**
  * Represents Elasticsearch "missing" filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the MissingQuery instead.
  */
-class MissingFilter implements BuilderInterface
+class MissingFilter extends MissingQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var string
-     */
-    private $field;
-
-    /**
-     * @param string $field      Field name.
-     * @param array  $parameters Optional parameters.
-     */
-    public function __construct($field, array $parameters = [])
-    {
-        $this->field = $field;
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'missing';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        $query = [];
-        $query['field'] = $this->field;
-
-        $output = $this->processArray($query);
-
-        return $output;
-    }
 }
diff --git a/src/Filter/NestedFilter.php b/src/Filter/NestedFilter.php
index 6b466a49eec316d0e92d39f3ae4f04e8cb065eff..120280285316dc84be76bf2b9dc4fa94fc93cea2 100644
--- a/src/Filter/NestedFilter.php
+++ b/src/Filter/NestedFilter.php
@@ -11,60 +11,29 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The NestedFilter class is deprecated and will be removed in 2.0. Use NestedQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\NestedQuery;
 
 /**
  * Nested filter implementation.
+ *
+ * @deprecated Will be removed in 2.0. Use the NestedQuery instead.
  */
-class NestedFilter implements BuilderInterface
+class NestedFilter extends NestedQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var string
-     */
-    private $path;
-
-    /**
-     * @var BuilderInterface
-     */
-    private $query;
-
-    /**
-     * @param string           $path
-     * @param BuilderInterface $query
-     * @param array            $parameters
-     */
-    public function __construct($path, BuilderInterface $query, array $parameters = [])
-    {
-        $this->path = $path;
-        $this->query = $query;
-        $this->parameters = $parameters;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'nested';
-    }
-
     /**
      * {@inheritdoc}
      */
     public function toArray()
     {
-        $query = [
-            'path' => $this->path,
-            'filter' => [
-                $this->query->getType() => $this->query->toArray(),
-            ],
-        ];
-
-        $output = $this->processArray($query);
+        $result = parent::toArray();
+        $result['filter'] = $result['query'];
+        unset($result['query']);
 
-        return $output;
+        return $result;
     }
 }
diff --git a/src/Filter/NotFilter.php b/src/Filter/NotFilter.php
index 8590ba451779c780abc39d8ceb86763bfc5514f0..d43653f5c087fc4d00393e2c2a1bc06f2a739e5a 100644
--- a/src/Filter/NotFilter.php
+++ b/src/Filter/NotFilter.php
@@ -11,6 +11,11 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
+@trigger_error(
+    'The NotFilter class is deprecated and will be removed in 2.0. Use BoolQuery instead.',
+    E_USER_DEPRECATED
+);
+
 use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
@@ -18,6 +23,8 @@ use ONGR\ElasticsearchDSL\ParametersTrait;
  * Represents Elasticsearch "not" filter.
  *
  * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-not-filter.html
+ *
+ * @deprecated Will be removed in 2.0. Use the BoolQuery instead.
  */
 class NotFilter implements BuilderInterface
 {
diff --git a/src/Filter/OrFilter.php b/src/Filter/OrFilter.php
index 53e22586bd4987714698ce27f5bc11d30d7c4fab..834b99e3e1c6e6655dbf1b1ba659f715adbd51a6 100644
--- a/src/Filter/OrFilter.php
+++ b/src/Filter/OrFilter.php
@@ -11,10 +11,17 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
+@trigger_error(
+    'The OrFilter class is deprecated and will be removed in 2.0. Use BoolQuery instead.',
+    E_USER_DEPRECATED
+);
+
 /**
  * Represents Elasticsearch "or" filter.
  *
  * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-or-filter.html
+ *
+ * @deprecated Will be removed in 2.0. Use the BoolQuery instead.
  */
 class OrFilter extends AndFilter
 {
diff --git a/src/Filter/PrefixFilter.php b/src/Filter/PrefixFilter.php
index 4d37438b43f6aa7205ad79df1177c16b3aa720d4..78d15ec82b6e01064852fd341d7482dc3a093654 100644
--- a/src/Filter/PrefixFilter.php
+++ b/src/Filter/PrefixFilter.php
@@ -11,48 +11,22 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The PrefixFilter class is deprecated and will be removed in 2.0. Use PrefixQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\PrefixQuery;
 
 /**
  * Represents Elasticsearch "prefix" filter.
  *
  * Filters documents that have fields containing terms with a specified prefix.
+ *
+ * @deprecated Will be removed in 2.0. Use the PrefixQuery instead.
  */
-class PrefixFilter implements BuilderInterface
+class PrefixFilter extends PrefixQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var string
-     */
-    protected $field;
-
-    /**
-     * @var string
-     */
-    protected $value;
-
-    /**
-     * @param string $field      Field name.
-     * @param string $value      Value.
-     * @param array  $parameters Optional parameters.
-     */
-    public function __construct($field, $value, array $parameters = [])
-    {
-        $this->field = $field;
-        $this->value = $value;
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'prefix';
-    }
-
     /**
      * {@inheritdoc}
      */
diff --git a/src/Filter/QueryFilter.php b/src/Filter/QueryFilter.php
index 7144ba33bd8b233e56a96003c0032952bb0087d8..f9f23cb035783186062d80b44c23766dc52e414c 100644
--- a/src/Filter/QueryFilter.php
+++ b/src/Filter/QueryFilter.php
@@ -11,11 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
+@trigger_error(
+    'The QueryFilter class is deprecated and will be removed in 2.0.',
+    E_USER_DEPRECATED
+);
+
 use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
  * Represents Elasticsearch "query" filter.
+ *
+ * @deprecated Will be removed in 2.0. The query filter has been removed as queries and filters have been merged.
  */
 class QueryFilter implements BuilderInterface
 {
diff --git a/src/Filter/RangeFilter.php b/src/Filter/RangeFilter.php
index 970f56833c302bf9f1dd4e7060a2dba3d12a0a16..c891684b20d6a92efff42f21c2a123d1ef53d61a 100644
--- a/src/Filter/RangeFilter.php
+++ b/src/Filter/RangeFilter.php
@@ -11,28 +11,22 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The RangeFilter class is deprecated and will be removed in 2.0. Use RangeQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\RangeQuery;
 
 /**
  * Represents Elasticsearch "range" filter.
  *
  * Filters documents with fields that have terms within a certain range.
+ *
+ * @deprecated Will be removed in 2.0. Use the RangeQuery instead.
  */
-class RangeFilter implements BuilderInterface
+class RangeFilter extends RangeQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var string
-     */
-    private $field;
-
-    /**
-     * @var array
-     */
-    private $range;
-
     /**
      * @param string $field      Field name.
      * @param array  $range      Range values.
@@ -40,28 +34,6 @@ class RangeFilter implements BuilderInterface
      */
     public function __construct($field, $range, array $parameters = [])
     {
-        $this->field = $field;
-        $this->range = $range;
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'range';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        $query = [$this->field => $this->range];
-
-        $output = $this->processArray($query);
-
-        return $output;
+        parent::__construct($field, array_merge($range, $parameters));
     }
 }
diff --git a/src/Filter/RegexpFilter.php b/src/Filter/RegexpFilter.php
index 20ef0e65c3b8598b594afb3c52e6916254cd3012..1bc03ecbd16a2621bda2e1a8d5a937602ad553df 100644
--- a/src/Filter/RegexpFilter.php
+++ b/src/Filter/RegexpFilter.php
@@ -11,11 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
+@trigger_error(
+    'The RegexpFilter class is deprecated and will be removed in 2.0. Use RegexpQuery instead.',
+    E_USER_DEPRECATED
+);
+
 use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
  * Represents Elasticsearch "regexp" filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the RegexpQuery instead.
  */
 class RegexpFilter implements BuilderInterface
 {
diff --git a/src/Filter/ScriptFilter.php b/src/Filter/ScriptFilter.php
index 1ee24665f1088ffed206728ac20ffea5abc8981f..5b751cdfb15348746c6ec40ac45b316a0aace41b 100644
--- a/src/Filter/ScriptFilter.php
+++ b/src/Filter/ScriptFilter.php
@@ -11,6 +11,11 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
+@trigger_error(
+    'The ScriptFilter class is deprecated and will be removed in 2.0. Use ScriptQuery instead.',
+    E_USER_DEPRECATED
+);
+
 use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
@@ -18,6 +23,8 @@ use ONGR\ElasticsearchDSL\ParametersTrait;
  * Represents Elasticsearch "script" filter.
  *
  * Allows to define scripts as filters.
+ *
+ * @deprecated Will be removed in 2.0. Use the ScriptQuery instead.
  */
 class ScriptFilter implements BuilderInterface
 {
diff --git a/src/Filter/TermFilter.php b/src/Filter/TermFilter.php
index 743108ad2bf0378d5ffe26cd961e597d41e0966d..fade730812f8828867236696d64d948e09390d62 100644
--- a/src/Filter/TermFilter.php
+++ b/src/Filter/TermFilter.php
@@ -11,16 +11,20 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The TermFilter class is deprecated and will be removed in 2.0. Use TermQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\TermQuery;
 
 /**
  * Represents Elasticsearch "term" filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the TermQuery instead.
  */
-class TermFilter implements BuilderInterface
+class TermFilter extends TermQuery
 {
-    use ParametersTrait;
-
     /**
      * @var string
      */
@@ -29,26 +33,17 @@ class TermFilter implements BuilderInterface
     /**
      * @var string
      */
-    private $term;
+    private $value;
 
     /**
-     * @param string $field      Field name.
-     * @param string $term       Field value.
-     * @param array  $parameters Optional parameters.
+     * {@inheritdoc}
      */
-    public function __construct($field, $term, array $parameters = [])
+    public function __construct($field, $value, array $parameters = [])
     {
         $this->field = $field;
-        $this->term = $term;
-        $this->setParameters($parameters);
-    }
+        $this->value = $value;
 
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'term';
+        parent::__construct($field, $value, $parameters);
     }
 
     /**
@@ -56,7 +51,7 @@ class TermFilter implements BuilderInterface
      */
     public function toArray()
     {
-        $query = [$this->field => $this->term];
+        $query = [$this->field => $this->value];
 
         $output = $this->processArray($query);
 
diff --git a/src/Filter/TermsFilter.php b/src/Filter/TermsFilter.php
index 672814a1d3580bba7ccc1a247e334f3e1400780e..c42fff8d069e8daa36168b45a94d392fae788d6d 100644
--- a/src/Filter/TermsFilter.php
+++ b/src/Filter/TermsFilter.php
@@ -11,55 +11,18 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
-use ONGR\ElasticsearchDSL\ParametersTrait;
+@trigger_error(
+    'The TermsFilter class is deprecated and will be removed in 2.0. Use TermsQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\TermsQuery;
 
 /**
  * Represents Elasticsearch "terms" filter.
+ *
+ * @deprecated Will be removed in 2.0. Use the TermsQuery instead.
  */
-class TermsFilter implements BuilderInterface
+class TermsFilter extends TermsQuery
 {
-    use ParametersTrait;
-
-    /**
-     * @var string
-     */
-    private $field;
-
-    /**
-     * @var array
-     */
-    private $terms;
-
-    /**
-     * @param string $field      Field name.
-     * @param array  $terms      An array of terms.
-     * @param array  $parameters Optional parameters.
-     */
-    public function __construct($field, $terms, array $parameters = [])
-    {
-        $this->field = $field;
-        $this->terms = $terms;
-        $this->setParameters($parameters);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'terms';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        $query = [$this->field => $this->terms];
-
-        $output = $this->processArray($query);
-
-        return $output;
-    }
 }
diff --git a/src/Filter/TypeFilter.php b/src/Filter/TypeFilter.php
index 7d947a5823fdabdd616fe4d0b0e989a78da7b6a3..018a59dcd9c5b10c106267e65f32812119079601 100644
--- a/src/Filter/TypeFilter.php
+++ b/src/Filter/TypeFilter.php
@@ -11,45 +11,20 @@
 
 namespace ONGR\ElasticsearchDSL\Filter;
 
-use ONGR\ElasticsearchDSL\BuilderInterface;
+@trigger_error(
+    'The TypeFilter class is deprecated and will be removed in 2.0. Use TypeQuery instead.',
+    E_USER_DEPRECATED
+);
+
+use ONGR\ElasticsearchDSL\Query\TypeQuery;
 
 /**
  * Represents Elasticsearch "type" filter.
  *
  * Filters documents matching the provided type.
+ *
+ * @deprecated Will be removed in 2.0. Use the TypeQuery instead.
  */
-class TypeFilter implements BuilderInterface
+class TypeFilter extends TypeQuery
 {
-    /**
-     * @var string
-     */
-    private $type;
-
-    /**
-     * Constructor.
-     *
-     * @param string $type Type name.
-     */
-    public function __construct($type)
-    {
-        $this->type = $type;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'type';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function toArray()
-    {
-        return [
-            'value' => $this->type,
-        ];
-    }
 }
diff --git a/src/Query/ExistsQuery.php b/src/Query/ExistsQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..1c62382a502c19f26fc5960596238162aa8f932c
--- /dev/null
+++ b/src/Query/ExistsQuery.php
@@ -0,0 +1,55 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+
+/**
+ * Represents Elasticsearch "exists" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html
+ */
+class ExistsQuery implements BuilderInterface
+{
+    /**
+     * @var string
+     */
+    private $field;
+
+    /**
+     * Constructor.
+     *
+     * @param string $field Field value
+     */
+    public function __construct($field)
+    {
+        $this->field = $field;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'exists';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        return [
+            'field' => $this->field,
+        ];
+    }
+}
diff --git a/src/Query/FilteredQuery.php b/src/Query/FilteredQuery.php
index f7b3dbe8ea50f22140db5cb686d0eb6a305af4b7..0d5504f3b4107737edc22997f24cac6f91b36a36 100644
--- a/src/Query/FilteredQuery.php
+++ b/src/Query/FilteredQuery.php
@@ -18,6 +18,8 @@ use ONGR\ElasticsearchDSL\ParametersTrait;
  * Represents Elasticsearch "bool" filter.
  *
  * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-filtered-query.html
+ *
+ * @deprecated Will be removed in 2.0. Use the `bool` query instead with a `filter` clause.
  */
 class FilteredQuery implements BuilderInterface
 {
@@ -39,6 +41,12 @@ class FilteredQuery implements BuilderInterface
      */
     public function __construct($query = null, $filter = null)
     {
+        @trigger_error(
+            'The FilteredQuery class is deprecated and will be removed in 2.0. ' .
+            'Use the "bool" query instead with a "filter" clause.',
+            E_USER_DEPRECATED
+        );
+
         if ($query !== null) {
             $this->setQuery($query);
         }
diff --git a/src/Query/GeoBoundingBoxQuery.php b/src/Query/GeoBoundingBoxQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..f77ce225ad98cddddf34081af0305b233ff4981b
--- /dev/null
+++ b/src/Query/GeoBoundingBoxQuery.php
@@ -0,0 +1,85 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+use ONGR\ElasticsearchDSL\ParametersTrait;
+
+/**
+ * Represents Elasticsearch "geo_bounding_box" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html
+ */
+class GeoBoundingBoxQuery implements BuilderInterface
+{
+    use ParametersTrait;
+
+    /**
+     * @var array
+     */
+    private $values;
+
+    /**
+     * @var string
+     */
+    private $field;
+
+    /**
+     * @param string $field
+     * @param array  $values
+     * @param array  $parameters
+     */
+    public function __construct($field, $values, array $parameters = [])
+    {
+        $this->field = $field;
+        $this->values = $values;
+        $this->setParameters($parameters);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'geo_bounding_box';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        if (count($this->values) === 2) {
+            $query = [
+                $this->field => [
+                    'top_left' => $this->values[0],
+                    'bottom_right' => $this->values[1],
+                ],
+            ];
+        } elseif (count($this->values) === 4) {
+            $query = [
+                $this->field => [
+                    'top' => $this->values[0],
+                    'left' => $this->values[1],
+                    'bottom' => $this->values[2],
+                    'right' => $this->values[3],
+                ],
+            ];
+        } else {
+            throw new \LogicException('Geo Bounding Box filter must have 2 or 4 geo points set.');
+        }
+
+        $output = $this->processArray($query);
+
+        return $output;
+    }
+}
diff --git a/src/Query/GeoDistanceQuery.php b/src/Query/GeoDistanceQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..477d8726e4e6b2a4a19655833ca56c6ec3ad2aa8
--- /dev/null
+++ b/src/Query/GeoDistanceQuery.php
@@ -0,0 +1,77 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+use ONGR\ElasticsearchDSL\ParametersTrait;
+
+/**
+ * Represents Elasticsearch "geo_distance" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html
+ */
+class GeoDistanceQuery implements BuilderInterface
+{
+    use ParametersTrait;
+
+    /**
+     * @var string
+     */
+    private $field;
+
+    /**
+     * @var string
+     */
+    private $distance;
+
+    /**
+     * @var mixed
+     */
+    private $location;
+
+    /**
+     * @param string $field
+     * @param string $distance
+     * @param mixed  $location
+     * @param array  $parameters
+     */
+    public function __construct($field, $distance, $location, array $parameters = [])
+    {
+        $this->field = $field;
+        $this->distance = $distance;
+        $this->location = $location;
+
+        $this->setParameters($parameters);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'geo_distance';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        $query = [
+            'distance' => $this->distance,
+            $this->field => $this->location,
+        ];
+        $output = $this->processArray($query);
+
+        return $output;
+    }
+}
diff --git a/src/Query/GeoDistanceRangeQuery.php b/src/Query/GeoDistanceRangeQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..ab9a8a31b10df856c309a993fb017bfb6aa6f866
--- /dev/null
+++ b/src/Query/GeoDistanceRangeQuery.php
@@ -0,0 +1,74 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+use ONGR\ElasticsearchDSL\ParametersTrait;
+
+/**
+ * Represents Elasticsearch "geo_distance_range" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-range-query.html
+ */
+class GeoDistanceRangeQuery implements BuilderInterface
+{
+    use ParametersTrait;
+
+    /**
+     * @var string
+     */
+    private $field;
+
+    /**
+     * @var array
+     */
+    private $range;
+
+    /**
+     * @var mixed
+     */
+    private $location;
+
+    /**
+     * @param string $field
+     * @param array  $range
+     * @param mixed  $location
+     * @param array  $parameters
+     */
+    public function __construct($field, $range, $location, array $parameters = [])
+    {
+        $this->field = $field;
+        $this->range = $range;
+        $this->location = $location;
+
+        $this->setParameters($parameters);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'geo_distance_range';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        $query = $this->range + [$this->field => $this->location];
+        $output = $this->processArray($query);
+
+        return $output;
+    }
+}
diff --git a/src/Query/GeoPolygonQuery.php b/src/Query/GeoPolygonQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..680ed8ec2c83299ce75190c2b97b8f44499fac5a
--- /dev/null
+++ b/src/Query/GeoPolygonQuery.php
@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+use ONGR\ElasticsearchDSL\ParametersTrait;
+
+/**
+ * Represents Elasticsearch "geo_polygon" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-polygon-query.html
+ */
+class GeoPolygonQuery implements BuilderInterface
+{
+    use ParametersTrait;
+
+    /**
+     * @var string
+     */
+    private $field;
+
+    /**
+     * @var array
+     */
+    private $points;
+
+    /**
+     * @param string $field
+     * @param array  $points
+     * @param array  $parameters
+     */
+    public function __construct($field, array $points = [], array $parameters = [])
+    {
+        $this->field = $field;
+        $this->points = $points;
+        $this->setParameters($parameters);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'geo_polygon';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        $query = [$this->field => ['points' => $this->points]];
+        $output = $this->processArray($query);
+
+        return $output;
+    }
+}
diff --git a/src/Query/GeoShapeQuery.php b/src/Query/GeoShapeQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..4360c855d8353cca2b3fd082468a2247f470dbd6
--- /dev/null
+++ b/src/Query/GeoShapeQuery.php
@@ -0,0 +1,102 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+use ONGR\ElasticsearchDSL\ParametersTrait;
+
+/**
+ * Represents Elasticsearch "geo_shape" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.html
+ */
+class GeoShapeQuery implements BuilderInterface
+{
+    use ParametersTrait;
+
+    /**
+     * @var array
+     */
+    private $fields = [];
+
+    /**
+     * @param array $parameters
+     */
+    public function __construct(array $parameters = [])
+    {
+        $this->setParameters($parameters);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'geo_shape';
+    }
+
+    /**
+     * Add geo-shape provided filter.
+     *
+     * @param string $field       Field name.
+     * @param string $type        Shape type.
+     * @param array  $coordinates Shape coordinates.
+     * @param array  $parameters  Additional parameters.
+     */
+    public function addShape($field, $type, array $coordinates, array $parameters = [])
+    {
+        $filter = array_merge(
+            $parameters,
+            [
+                'type' => $type,
+                'coordinates' => $coordinates,
+            ]
+        );
+
+        $this->fields[$field]['shape'] = $filter;
+    }
+
+    /**
+     * Add geo-shape pre-indexed filter.
+     *
+     * @param string $field      Field name.
+     * @param string $id         The ID of the document that containing the pre-indexed shape.
+     * @param string $type       Name of the index where the pre-indexed shape is.
+     * @param string $index      Index type where the pre-indexed shape is.
+     * @param string $path       The field specified as path containing the pre-indexed shape.
+     * @param array  $parameters Additional parameters.
+     */
+    public function addPreIndexedShape($field, $id, $type, $index, $path, array $parameters = [])
+    {
+        $filter = array_merge(
+            $parameters,
+            [
+                'id' => $id,
+                'type' => $type,
+                'index' => $index,
+                'path' => $path,
+            ]
+        );
+
+        $this->fields[$field]['indexed_shape'] = $filter;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        $output = $this->processArray($this->fields);
+
+        return $output;
+    }
+}
diff --git a/src/Query/GeohashCellQuery.php b/src/Query/GeohashCellQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..8c54a7d6848db5d6aab6fc92f26aa48e4fb3494a
--- /dev/null
+++ b/src/Query/GeohashCellQuery.php
@@ -0,0 +1,67 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+use ONGR\ElasticsearchDSL\ParametersTrait;
+
+/**
+ * Represents Elasticsearch "geohash_cell" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geohash-cell-query.html
+ */
+class GeohashCellQuery implements BuilderInterface
+{
+    use ParametersTrait;
+
+    /**
+     * @var string
+     */
+    private $field;
+
+    /**
+     * @var mixed
+     */
+    private $location;
+
+    /**
+     * @param string $field
+     * @param mixed  $location
+     * @param array  $parameters
+     */
+    public function __construct($field, $location, array $parameters = [])
+    {
+        $this->field = $field;
+        $this->location = $location;
+
+        $this->setParameters($parameters);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'geohash_cell';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        $query = [$this->field => $this->location];
+        $output = $this->processArray($query);
+
+        return $output;
+    }
+}
diff --git a/src/Query/HasChildQuery.php b/src/Query/HasChildQuery.php
index b40462f9914bf0f9a1176d460134ce31758d9812..e12214059cdf292fe470de8dc0521f271183ce85 100644
--- a/src/Query/HasChildQuery.php
+++ b/src/Query/HasChildQuery.php
@@ -15,7 +15,9 @@ use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
- * Elasticsearch has_child query class.
+ * Represents Elasticsearch "has_child" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-child-query.html
  */
 class HasChildQuery implements BuilderInterface
 {
diff --git a/src/Query/HasParentQuery.php b/src/Query/HasParentQuery.php
index 1fb1816b7281c518341952125f0f01ab142cd8ab..4b98a0e255e7be916cd5bb372897897d4bd20e0a 100644
--- a/src/Query/HasParentQuery.php
+++ b/src/Query/HasParentQuery.php
@@ -15,7 +15,9 @@ use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
- * Elasticsearch has_parent query class.
+ * Represents Elasticsearch "has_parent" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-parent-query.html
  */
 class HasParentQuery implements BuilderInterface
 {
diff --git a/src/Query/IdsQuery.php b/src/Query/IdsQuery.php
index 5b2b3addf244412d1e0ce9493add564cb6d1bb8f..60cf333044efaa1ead428bfdd4094ac26ac898d0 100644
--- a/src/Query/IdsQuery.php
+++ b/src/Query/IdsQuery.php
@@ -15,7 +15,9 @@ use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
- * Elasticsearch ids query class.
+ * Represents Elasticsearch "ids" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-ids-query.html
  */
 class IdsQuery implements BuilderInterface
 {
diff --git a/src/Query/IndicesQuery.php b/src/Query/IndicesQuery.php
index 8633f210354468ba49447625c6f70bf24cc184e0..501ba169e378fdf272cef60ef1faf329c652cc89 100644
--- a/src/Query/IndicesQuery.php
+++ b/src/Query/IndicesQuery.php
@@ -14,7 +14,9 @@ namespace ONGR\ElasticsearchDSL\Query;
 use ONGR\ElasticsearchDSL\BuilderInterface;
 
 /**
- * Elasticsearch indices query class.
+ * Represents Elasticsearch "indices" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-indices-query.html
  */
 class IndicesQuery implements BuilderInterface
 {
diff --git a/src/Query/LimitQuery.php b/src/Query/LimitQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..939b913ecada47488e0527f71974000f648314e9
--- /dev/null
+++ b/src/Query/LimitQuery.php
@@ -0,0 +1,53 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+
+/**
+ * Represents Elasticsearch "limit" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-limit-query.html
+ */
+class LimitQuery implements BuilderInterface
+{
+    /**
+     * @var int
+     */
+    private $value;
+
+    /**
+     * @param int $value Number of documents (per shard) to execute on
+     */
+    public function __construct($value)
+    {
+        $this->value = $value;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'limit';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        return [
+            'value' => $this->value,
+        ];
+    }
+}
diff --git a/src/Query/MatchAllQuery.php b/src/Query/MatchAllQuery.php
index b8a86da69452dba3b56dfbd5590d8e2a12339b29..88ce0b673c77827dbe59667d32d0b717d8190288 100644
--- a/src/Query/MatchAllQuery.php
+++ b/src/Query/MatchAllQuery.php
@@ -15,7 +15,9 @@ use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
- * Elasticsearch match_all query class.
+ * Represents Elasticsearch "bool" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-query.html
  */
 class MatchAllQuery implements BuilderInterface
 {
diff --git a/src/Query/MissingQuery.php b/src/Query/MissingQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..2acb7db4b2d8a90d3f0cfd4d7903692347acb3cb
--- /dev/null
+++ b/src/Query/MissingQuery.php
@@ -0,0 +1,61 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+use ONGR\ElasticsearchDSL\ParametersTrait;
+
+/**
+ * Represents Elasticsearch "missing" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-missing-query.html
+ */
+class MissingQuery implements BuilderInterface
+{
+    use ParametersTrait;
+
+    /**
+     * @var string
+     */
+    private $field;
+
+    /**
+     * Constructor.
+     *
+     * @param string $field      Field name
+     * @param array  $parameters Optional parameters
+     */
+    public function __construct($field, array $parameters = [])
+    {
+        $this->field = $field;
+        $this->setParameters($parameters);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'missing';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        $query = ['field' => $this->field];
+        $output = $this->processArray($query);
+
+        return $output;
+    }
+}
diff --git a/src/Query/NestedQuery.php b/src/Query/NestedQuery.php
index b9196fae736de8357d070f41a7ce116e5affdec1..76a30aa318dc3caf17a6b3e54bd879eaa2390552 100644
--- a/src/Query/NestedQuery.php
+++ b/src/Query/NestedQuery.php
@@ -15,7 +15,9 @@ use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
- * Elasticsearch nested query class.
+ * Represents Elasticsearch "nested" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html
  */
 class NestedQuery implements BuilderInterface
 {
@@ -34,11 +36,13 @@ class NestedQuery implements BuilderInterface
     /**
      * @param string           $path
      * @param BuilderInterface $query
+     * @param array            $parameters
      */
-    public function __construct($path, BuilderInterface $query)
+    public function __construct($path, BuilderInterface $query, array $parameters = [])
     {
         $this->path = $path;
         $this->query = $query;
+        $this->parameters = $parameters;
     }
 
     /**
diff --git a/src/Query/PrefixQuery.php b/src/Query/PrefixQuery.php
index 09e655e8be99977926cd918608aee4a78603c7f3..9f99411e6903bda7df23fb32ba535aa62dd6bf6d 100644
--- a/src/Query/PrefixQuery.php
+++ b/src/Query/PrefixQuery.php
@@ -11,13 +11,48 @@
 
 namespace ONGR\ElasticsearchDSL\Query;
 
-use ONGR\ElasticsearchDSL\Filter\PrefixFilter;
+use ONGR\ElasticsearchDSL\BuilderInterface;
+use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
  * Represents Elasticsearch "prefix" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-query.html
  */
-class PrefixQuery extends PrefixFilter
+class PrefixQuery implements BuilderInterface
 {
+    use ParametersTrait;
+
+    /**
+     * @var string
+     */
+    protected $field;
+
+    /**
+     * @var string
+     */
+    protected $value;
+
+    /**
+     * @param string $field      Field name.
+     * @param string $value      Value.
+     * @param array  $parameters Optional parameters.
+     */
+    public function __construct($field, $value, array $parameters = [])
+    {
+        $this->field = $field;
+        $this->value = $value;
+        $this->setParameters($parameters);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'prefix';
+    }
+
     /**
      * {@inheritdoc}
      */
diff --git a/src/Query/RegexpQuery.php b/src/Query/RegexpQuery.php
index e5ace954a2cb601e75ed2ab07b11162b471632d2..8887000d7c526e71ad3fde4432cc04e15d4607f4 100644
--- a/src/Query/RegexpQuery.php
+++ b/src/Query/RegexpQuery.php
@@ -15,7 +15,9 @@ use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
- * Regexp query class.
+ * Represents Elasticsearch "regexp" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html
  */
 class RegexpQuery implements BuilderInterface
 {
diff --git a/src/Query/ScriptQuery.php b/src/Query/ScriptQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..805907b06a333071472e52b0162b868f1c4d00bb
--- /dev/null
+++ b/src/Query/ScriptQuery.php
@@ -0,0 +1,59 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+use ONGR\ElasticsearchDSL\ParametersTrait;
+
+/**
+ * Represents Elasticsearch "script" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-query.html
+ */
+class ScriptQuery implements BuilderInterface
+{
+    use ParametersTrait;
+
+    /**
+     * @var string
+     */
+    private $script;
+
+    /**
+     * @param string $script     Script
+     * @param array  $parameters Optional parameters
+     */
+    public function __construct($script, array $parameters = [])
+    {
+        $this->script = $script;
+        $this->setParameters($parameters);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'script';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        $query = ['inline' => $this->script];
+        $output = $this->processArray($query);
+
+        return ['script' => $output];
+    }
+}
diff --git a/src/Query/TermQuery.php b/src/Query/TermQuery.php
index e561721f0d864141cf2991d4af3813a7c44597c8..d52fff9516ccc35c9388305e501e0ab34147f682 100644
--- a/src/Query/TermQuery.php
+++ b/src/Query/TermQuery.php
@@ -15,7 +15,9 @@ use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
- * Elasticsearch term query class.
+ * Represents Elasticsearch "term" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html
  */
 class TermQuery implements BuilderInterface
 {
diff --git a/src/Query/TermsQuery.php b/src/Query/TermsQuery.php
index a52c0624e3868c0cd9bc41a2f0e07edf4435350c..0c5e544282231e20d7b3f377abe847e7e999b489 100644
--- a/src/Query/TermsQuery.php
+++ b/src/Query/TermsQuery.php
@@ -15,7 +15,9 @@ use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
 /**
- * Elasticsearch terms query class.
+ * Represents Elasticsearch "terms" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html
  */
 class TermsQuery implements BuilderInterface
 {
@@ -29,17 +31,19 @@ class TermsQuery implements BuilderInterface
     /**
      * @var array
      */
-    private $tags;
+    private $terms;
 
     /**
-     * @param string $field
-     * @param array  $tags
-     * @param array  $parameters
+     * Constructor.
+     *
+     * @param string $field      Field name
+     * @param array  $terms      An array of terms
+     * @param array  $parameters Optional parameters
      */
-    public function __construct($field, $tags, array $parameters = [])
+    public function __construct($field, $terms, array $parameters = [])
     {
         $this->field = $field;
-        $this->tags = $tags;
+        $this->terms = $terms;
         $this->setParameters($parameters);
     }
 
@@ -57,7 +61,7 @@ class TermsQuery implements BuilderInterface
     public function toArray()
     {
         $query = [
-            $this->field => $this->tags,
+            $this->field => $this->terms,
         ];
 
         $output = $this->processArray($query);
diff --git a/src/Query/TypeQuery.php b/src/Query/TypeQuery.php
new file mode 100644
index 0000000000000000000000000000000000000000..843fca9d0e62cb959e279c33f06d9819e67a87e9
--- /dev/null
+++ b/src/Query/TypeQuery.php
@@ -0,0 +1,55 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Query;
+
+use ONGR\ElasticsearchDSL\BuilderInterface;
+
+/**
+ * Represents Elasticsearch "type" query.
+ *
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-type-query.html
+ */
+class TypeQuery implements BuilderInterface  // TODO: add test
+{
+    /**
+     * @var string
+     */
+    private $type;
+
+    /**
+     * Constructor.
+     *
+     * @param string $type Type name
+     */
+    public function __construct($type)
+    {
+        $this->type = $type;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getType()
+    {
+        return 'type';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toArray()
+    {
+        return [
+            'value' => $this->type,
+        ];
+    }
+}
diff --git a/tests/Aggregation/CardinalityAggregationTest.php b/tests/Aggregation/CardinalityAggregationTest.php
index 607948f2fb9ddfab25484333be0fd8979a4cc370..934f2743dadd86cabe6e4d134939ea58a8dfc996 100644
--- a/tests/Aggregation/CardinalityAggregationTest.php
+++ b/tests/Aggregation/CardinalityAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\CardinalityAggregation;
 
diff --git a/tests/Aggregation/ChildrenAggregationTest.php b/tests/Aggregation/ChildrenAggregationTest.php
index ceb7e3d065d256e551f44b52fa4d90677a3d2ae6..89eeced273842f01835a75a11cca86a767f08766 100644
--- a/tests/Aggregation/ChildrenAggregationTest.php
+++ b/tests/Aggregation/ChildrenAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\ChildrenAggregation;
 
diff --git a/tests/Aggregation/DateRangeAggregationTest.php b/tests/Aggregation/DateRangeAggregationTest.php
index e9050240650d76e9f989b6196186ff2b6a02c04c..718f8a85a590d37dae20d1592874d9396f25c779 100644
--- a/tests/Aggregation/DateRangeAggregationTest.php
+++ b/tests/Aggregation/DateRangeAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\DateRangeAggregation;
 
diff --git a/tests/Aggregation/FilterAggregationTest.php b/tests/Aggregation/FilterAggregationTest.php
index 27d0b0c87eda9d58c8c87390f706a2ef206fb647..43de57d04210065994d0e6d758cd264914812e3c 100644
--- a/tests/Aggregation/FilterAggregationTest.php
+++ b/tests/Aggregation/FilterAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\FilterAggregation;
diff --git a/tests/Aggregation/FiltersAggregationTest.php b/tests/Aggregation/FiltersAggregationTest.php
index 3a6a9025116bbb43a5637ad52da0c767fff85da3..379f3da100f33088cdc231c02106b76d34e6d3aa 100644
--- a/tests/Aggregation/FiltersAggregationTest.php
+++ b/tests/Aggregation/FiltersAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\FiltersAggregation;
diff --git a/tests/Aggregation/GeoBoundsAggregationTest.php b/tests/Aggregation/GeoBoundsAggregationTest.php
index ac1ebfaad3f84df7eef908e5e04b8769392e0dc4..24376fb71fce5cdbf1f9a2a2070a1d182299db9d 100644
--- a/tests/Aggregation/GeoBoundsAggregationTest.php
+++ b/tests/Aggregation/GeoBoundsAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\GeoBoundsAggregation;
diff --git a/tests/Aggregation/GeoDistanceAggregationTest.php b/tests/Aggregation/GeoDistanceAggregationTest.php
index b4ec0f3359ea5ec355e1be3ea53f21a1d72c3ac5..513f246b552931f07ec376cf243ffa5b5e3bd689 100644
--- a/tests/Aggregation/GeoDistanceAggregationTest.php
+++ b/tests/Aggregation/GeoDistanceAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\GeoDistanceAggregation;
 
diff --git a/tests/Aggregation/GeoHashGridAggregationTest.php b/tests/Aggregation/GeoHashGridAggregationTest.php
index 489d1715d4166303ca4f447cb89327b5b7ca6975..e97a022b6919668df575e80037e9f7a0468ec14a 100644
--- a/tests/Aggregation/GeoHashGridAggregationTest.php
+++ b/tests/Aggregation/GeoHashGridAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\GeoHashGridAggregation;
 
diff --git a/tests/Aggregation/GlobalAggregationTest.php b/tests/Aggregation/GlobalAggregationTest.php
index 357eb4c6500f0da9613239944be29ffbdc93c895..b2e8850053b383933948a1fbd3a745f95dbc999c 100644
--- a/tests/Aggregation/GlobalAggregationTest.php
+++ b/tests/Aggregation/GlobalAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\GlobalAggregation;
 
diff --git a/tests/Aggregation/Ipv4RangeAggregationTest.php b/tests/Aggregation/Ipv4RangeAggregationTest.php
index 846c4dda34281566857ceb7a59f3e7b9ca7aab27..0582f68082862f7a8cdd4a560cd8d0f3773b1a62 100644
--- a/tests/Aggregation/Ipv4RangeAggregationTest.php
+++ b/tests/Aggregation/Ipv4RangeAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\Ipv4RangeAggregation;
diff --git a/tests/Aggregation/MissingAggregationTest.php b/tests/Aggregation/MissingAggregationTest.php
index 1caae742cb3e3f1e3cfdec0cc4a085f8006b1728..ffa66d57c6f2b9cfbc2113e00fee91c4c4213f93 100644
--- a/tests/Aggregation/MissingAggregationTest.php
+++ b/tests/Aggregation/MissingAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\MissingAggregation;
 
diff --git a/tests/Aggregation/NestedAggregationTest.php b/tests/Aggregation/NestedAggregationTest.php
index fd592944d69898c0771b61df63e0e172e5aa24e2..736ac533a945bdc87cfb593a3efdfad60f95aea4 100644
--- a/tests/Aggregation/NestedAggregationTest.php
+++ b/tests/Aggregation/NestedAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\NestedAggregation;
diff --git a/tests/Aggregation/PercentileRanksAggregationTest.php b/tests/Aggregation/PercentileRanksAggregationTest.php
index 95d93d6508a580fa3d712c76c7867a239bac6cde..e2f8914c2d0964384e23e721c33550eebb6b7e83 100644
--- a/tests/Aggregation/PercentileRanksAggregationTest.php
+++ b/tests/Aggregation/PercentileRanksAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\PercentileRanksAggregation;
diff --git a/tests/Aggregation/PercentilesAggregationTest.php b/tests/Aggregation/PercentilesAggregationTest.php
index b4492f42d416b986e7f66425b33f27506a3659c7..2357f356034461862e09edf43495ad38e9f3a749 100644
--- a/tests/Aggregation/PercentilesAggregationTest.php
+++ b/tests/Aggregation/PercentilesAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\PercentilesAggregation;
 
diff --git a/tests/Aggregation/RangeAggregationTest.php b/tests/Aggregation/RangeAggregationTest.php
index 87c5be36acf5e1485c22872eff53c8488c796cbc..dec054e8cd5deec081918ac8ce08357fde91a72e 100644
--- a/tests/Aggregation/RangeAggregationTest.php
+++ b/tests/Aggregation/RangeAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\RangeAggregation;
diff --git a/tests/Aggregation/ReverseNestedAggregationTest.php b/tests/Aggregation/ReverseNestedAggregationTest.php
index 0c797121fdc9839b97434199131483d9ac4e6f62..407073826addf87dabbd6c068f796c86b78cd255 100644
--- a/tests/Aggregation/ReverseNestedAggregationTest.php
+++ b/tests/Aggregation/ReverseNestedAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\ReverseNestedAggregation;
diff --git a/tests/Aggregation/StatsAggregationTest.php b/tests/Aggregation/StatsAggregationTest.php
index cd85cd986d9d645d2babb2acffbabd6a8b3428ee..8ed469b831266fb98424c80b87986430bed35129 100644
--- a/tests/Aggregation/StatsAggregationTest.php
+++ b/tests/Aggregation/StatsAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\StatsAggregation;
diff --git a/tests/Aggregation/TermsAggregationTest.php b/tests/Aggregation/TermsAggregationTest.php
index 52f724a4dfe41e69ff99a4b18d78fca0cd166edd..dab248a0462d54033fdd74651fd0d5745869dda5 100644
--- a/tests/Aggregation/TermsAggregationTest.php
+++ b/tests/Aggregation/TermsAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\TermsAggregation;
diff --git a/tests/Aggregation/TopHitsAggregationTest.php b/tests/Aggregation/TopHitsAggregationTest.php
index 5ac784df04aaf968ca48310034b4ffb8cc25fe4c..70b18ae3657792d15f0cc51b04b630ddf0ad22d0 100644
--- a/tests/Aggregation/TopHitsAggregationTest.php
+++ b/tests/Aggregation/TopHitsAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\TopHitsAggregation;
 use ONGR\ElasticsearchDSL\Sort\FieldSort;
diff --git a/tests/Filter/AndFilterTest.php b/tests/Filter/AndFilterTest.php
index b7c60aba1ede6fe3006124270fcf151e1ee082d5..e768a506672c50b70b566f9d83650caca7b22dff 100644
--- a/tests/Filter/AndFilterTest.php
+++ b/tests/Filter/AndFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\AndFilter;
 
diff --git a/tests/Filter/ExistsFilterTest.php b/tests/Filter/ExistsFilterTest.php
index 76524c6d3bad61ee5fa095663df7d7a7842b3e23..fa46ac6ca4bcdf2d6b92751c79c5fe208b1cf683 100644
--- a/tests/Filter/ExistsFilterTest.php
+++ b/tests/Filter/ExistsFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\ExistsFilter;
 
diff --git a/tests/Filter/GeoBoundingBoxFilterTest.php b/tests/Filter/GeoBoundingBoxFilterTest.php
index 6ab76b7d56aa4086980d186ed6794b2ef665da8a..69abbc94e1ac4beb95e5d53e8e528c1f21101c96 100644
--- a/tests/Filter/GeoBoundingBoxFilterTest.php
+++ b/tests/Filter/GeoBoundingBoxFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\GeoBoundingBoxFilter;
 
diff --git a/tests/Filter/GeoDistanceFilterTest.php b/tests/Filter/GeoDistanceFilterTest.php
index 888ccbc94983294266c96744bad7c14073e068e2..f76eb3b92d73bc2cc161311f39c1637372d28e17 100644
--- a/tests/Filter/GeoDistanceFilterTest.php
+++ b/tests/Filter/GeoDistanceFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\GeoDistanceFilter;
 
diff --git a/tests/Filter/GeoDistanceRangeFilterTest.php b/tests/Filter/GeoDistanceRangeFilterTest.php
index 206d9d1434b2986fb4ab6e8d76065252fa9e7b78..69087113b8ffdc686375d3e0f688b3139fc8909a 100644
--- a/tests/Filter/GeoDistanceRangeFilterTest.php
+++ b/tests/Filter/GeoDistanceRangeFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\GeoDistanceRangeFilter;
 
diff --git a/tests/Filter/GeoPolygonFilterTest.php b/tests/Filter/GeoPolygonFilterTest.php
index bc0e8d5644d7921d1ea53bfa1d636403e83055fc..97c3c7eda7c5efbb94b5d4c5fe6853bac848e6f0 100644
--- a/tests/Filter/GeoPolygonFilterTest.php
+++ b/tests/Filter/GeoPolygonFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\GeoPolygonFilter;
 
diff --git a/tests/Filter/HasChildFilterTest.php b/tests/Filter/HasChildFilterTest.php
index bfce34420a7ca65bc3f4bb8783c89bc45d05e9a5..0be852a44e1d0338285110297c0811f4e478fbee 100644
--- a/tests/Filter/HasChildFilterTest.php
+++ b/tests/Filter/HasChildFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\HasChildFilter;
 
diff --git a/tests/Filter/HasParentFilterTest.php b/tests/Filter/HasParentFilterTest.php
index b08ed84b2f261c413fa63094563cd66cd0e3a548..d0ad8a56b8730effbc30762645b8bbbb1fa594b6 100644
--- a/tests/Filter/HasParentFilterTest.php
+++ b/tests/Filter/HasParentFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\HasParentFilter;
 
diff --git a/tests/Filter/IdsFilterTest.php b/tests/Filter/IdsFilterTest.php
index ca68d4320b6951981bd719bc156c1088b2d60590..84ff9e9dd4c4cbcf790abc0dcbe920283cc2063e 100644
--- a/tests/Filter/IdsFilterTest.php
+++ b/tests/Filter/IdsFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\IdsFilter;
 
diff --git a/tests/Filter/IndicesFilterTest.php b/tests/Filter/IndicesFilterTest.php
index 3afbffa3c5f20cd0356b2c1e2b2da3a0d6673b04..d6c602718348d6bedd4689b9bc58a742c30eff95 100644
--- a/tests/Filter/IndicesFilterTest.php
+++ b/tests/Filter/IndicesFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\IndicesFilter;
 
diff --git a/tests/Filter/LimitFilterTest.php b/tests/Filter/LimitFilterTest.php
index d60caf751ed26b2612825333d57713007394c14c..41b963f2620c706f0e1b3b89981d9fd8c9785d3c 100644
--- a/tests/Filter/LimitFilterTest.php
+++ b/tests/Filter/LimitFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\LimitFilter;
 
diff --git a/tests/Filter/MatchAllFilterTest.php b/tests/Filter/MatchAllFilterTest.php
index 3019a8e9291aec872b52fa896fc192b8bf8bdbce..eb2b2f6f14e85fb16c4af2a1df0a4f2ca16ff067 100644
--- a/tests/Filter/MatchAllFilterTest.php
+++ b/tests/Filter/MatchAllFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\MatchAllFilter;
 
diff --git a/tests/Filter/MissingFilterTest.php b/tests/Filter/MissingFilterTest.php
index 65534a2a38ad3ea65f9dc2340991be82dff4f546..7ebab6b0ea588e0247c1519d17e1b9c0446e8e52 100644
--- a/tests/Filter/MissingFilterTest.php
+++ b/tests/Filter/MissingFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\MissingFilter;
 
diff --git a/tests/Filter/NestedFilterTest.php b/tests/Filter/NestedFilterTest.php
index b201973e24ae0cf3d107eb73ed4a44b56a610c4b..361a0279bd90d3663ba36939e3906214795f7b1f 100644
--- a/tests/Filter/NestedFilterTest.php
+++ b/tests/Filter/NestedFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\NestedFilter;
 use ONGR\ElasticsearchDSL\Filter\TermFilter;
diff --git a/tests/Filter/NotFilterTest.php b/tests/Filter/NotFilterTest.php
index 409408c366e6acb994da31df596e1228ee05379f..c35e234631e77f3b56c3800b4c70031ad2dfeafe 100644
--- a/tests/Filter/NotFilterTest.php
+++ b/tests/Filter/NotFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\NotFilter;
 
diff --git a/tests/Filter/OrFilterTest.php b/tests/Filter/OrFilterTest.php
index 77c43a1194c8aa61d9b33190128ea72e6dcb79a0..94682db0356ae78c04b73528897ddc2faa32c654 100644
--- a/tests/Filter/OrFilterTest.php
+++ b/tests/Filter/OrFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\OrFilter;
 
diff --git a/tests/Filter/PrefixFilterTest.php b/tests/Filter/PrefixFilterTest.php
index 2cf76131a46936d4529c5c5823c6f187f79eb0f4..cb154d2569ee7c355a801d60c8409be8237c5784 100644
--- a/tests/Filter/PrefixFilterTest.php
+++ b/tests/Filter/PrefixFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\PrefixFilter;
 
diff --git a/tests/Filter/QueryFilterTest.php b/tests/Filter/QueryFilterTest.php
index 71608e96565088b22b4ce5d02dfd7352ea328002..ceeeff4681e9548529427c327c05594b68eb12fa 100644
--- a/tests/Filter/QueryFilterTest.php
+++ b/tests/Filter/QueryFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\QueryFilter;
 
diff --git a/tests/Filter/RangeFilterTest.php b/tests/Filter/RangeFilterTest.php
index 3c6589b79331757e1f1ba550f0c7e2df80b0f1d4..ab59eec4b215fe3e13da5141c29aa4a45eea7fdd 100644
--- a/tests/Filter/RangeFilterTest.php
+++ b/tests/Filter/RangeFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\RangeFilter;
 
@@ -35,9 +35,14 @@ class RangeFilterTest extends \PHPUnit_Framework_TestCase
             // Case #1.
             ['', [], [], ['' => []]],
             // Case #2.
-            ['foo', [1, 5], [], ['foo' => [0 => 1, 1 => 5]]],
+            ['foo', ['gte' => 1, 'lte' => 5], [], ['foo' => ['gte' => 1, 'lte' => 5]]],
             // Case #3.
-            ['test', ['foo', 'bar'], ['type' => 'acme'], ['test' => [0 => 'foo', 1 => 'bar'], 'type' => 'acme']],
+            [
+                'test',
+                ['gte' => 1, 'lte' => 5],
+                ['type' => 'acme'],
+                ['test' => ['gte' => 1, 'lte' => 5, 'type' => 'acme']]
+            ],
         ];
     }
 
diff --git a/tests/Filter/RegexpFilterTest.php b/tests/Filter/RegexpFilterTest.php
index d0f3e91e29b9f38956f1367c62b01c6adc666143..1f7aa947e3524a4c7d99c94bdf4d1d6bd1a7d2e1 100644
--- a/tests/Filter/RegexpFilterTest.php
+++ b/tests/Filter/RegexpFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\RegexpFilter;
 
diff --git a/tests/Filter/ScriptFilterTest.php b/tests/Filter/ScriptFilterTest.php
index 2125fb7466b22dafeae4ab22e6210f1b0a026e01..514af912f20907672e4f356d1552c1526da01057 100644
--- a/tests/Filter/ScriptFilterTest.php
+++ b/tests/Filter/ScriptFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\ScriptFilter;
 
diff --git a/tests/Filter/TermFilterTest.php b/tests/Filter/TermFilterTest.php
index ec7f5f00428b2cd40edb4e3d1d4845c78a58a376..07b775ef31704f504f03918f956ef3e69052e2c3 100644
--- a/tests/Filter/TermFilterTest.php
+++ b/tests/Filter/TermFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\TermFilter;
 
diff --git a/tests/Filter/TermsFilterTest.php b/tests/Filter/TermsFilterTest.php
index 7f5a797ad060f01243c629f631ead8feb9037f57..1fd3286f66e31effb6ab9de6517b5e375034165c 100644
--- a/tests/Filter/TermsFilterTest.php
+++ b/tests/Filter/TermsFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\TermsFilter;
 
diff --git a/tests/Filter/TypeFilterTest.php b/tests/Filter/TypeFilterTest.php
index 7ffb00caff562319ec4ddcb02e393d1a53b99fb2..18ae31589f29becbcb36d857e4f814956eed66fc 100644
--- a/tests/Filter/TypeFilterTest.php
+++ b/tests/Filter/TypeFilterTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Filter;
+namespace ONGR\ElasticsearchDSL\Tests\Filter;
 
 use ONGR\ElasticsearchDSL\Filter\TypeFilter;
 
diff --git a/tests/Highlight/HighlightTest.php b/tests/Highlight/HighlightTest.php
index a774a2f3eb4815e607b8b2b3ec4bec91a2a3ffcd..1b75447bfd19eabcb9642c6d494cd6ac4f40517b 100644
--- a/tests/Highlight/HighlightTest.php
+++ b/tests/Highlight/HighlightTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Highlight;
+namespace ONGR\ElasticsearchDSL\Tests\Highlight;
 
 use ONGR\ElasticsearchDSL\Highlight\Highlight;
 
diff --git a/tests/Query/BoolQueryTest.php b/tests/Query/BoolQueryTest.php
index dfe985196653b35c5a4ea08994e3cbaf4aeba2b2..dd0147faa32624267271cfdc96123e61d6fa1fda 100644
--- a/tests/Query/BoolQueryTest.php
+++ b/tests/Query/BoolQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
 
 use ONGR\ElasticsearchDSL\Query\BoolQuery;
 use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
diff --git a/tests/Query/ExistsQueryTest.php b/tests/Query/ExistsQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..4695fad525f72a9fa013a16df7f2beb00d75e5ac
--- /dev/null
+++ b/tests/Query/ExistsQueryTest.php
@@ -0,0 +1,29 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Query\ExistsQuery;
+
+/**
+ * Unit test for ExistsQuery.
+ */
+class ExistsQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Tests ExistsQuery#toArray() method.
+     */
+    public function testToArray()
+    {
+        $query = new ExistsQuery('bar');
+        $this->assertEquals(['field' => 'bar'], $query->toArray());
+    }
+}
diff --git a/tests/Query/FunctionScoreQueryTest.php b/tests/Query/FunctionScoreQueryTest.php
index 85c034da46fb0d7d5597c2ccf19f855bb9f2de4d..7e2fbb45005a60ca7722530a22c746f71d4f2c18 100644
--- a/tests/Query/FunctionScoreQueryTest.php
+++ b/tests/Query/FunctionScoreQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Query;
 
 use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\Query\FunctionScoreQuery;
diff --git a/tests/Query/FuzzyLikeThisQueryTest.php b/tests/Query/FuzzyLikeThisQueryTest.php
index 3563b6455f9fee75c1e1a16398b40ce3eef6b583..ce68de1c70951c6b3b563be25771a55252aac23d 100644
--- a/tests/Query/FuzzyLikeThisQueryTest.php
+++ b/tests/Query/FuzzyLikeThisQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Query;
 
 use ONGR\ElasticsearchDSL\Query\FuzzyLikeThisQuery;
 
diff --git a/tests/Query/GeoBoundingBoxQueryTest.php b/tests/Query/GeoBoundingBoxQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..93c70ab75d601a0bd1941f889df695493baeed13
--- /dev/null
+++ b/tests/Query/GeoBoundingBoxQueryTest.php
@@ -0,0 +1,87 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Filter\GeoBoundingBoxFilter;
+
+class GeoBoundingBoxQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Test if exception is thrown when geo points are not set.
+     *
+     * @expectedException \LogicException
+     */
+    public function testGeoBoundBoxFilterException()
+    {
+        $filter = new GeoBoundingBoxFilter('location', []);
+        $filter->toArray();
+    }
+
+    /**
+     * Data provider for testToArray().
+     *
+     * @return array
+     */
+    public function getArrayDataProvider()
+    {
+        return [
+            // Case #1 (2 values).
+            [
+                'location',
+                [
+                    ['lat' => 40.73, 'lon' => -74.1],
+                    ['lat' => 40.01, 'lon' => -71.12],
+                ],
+                ['parameter' => 'value'],
+                [
+                    'location' => [
+                        'top_left' => ['lat' => 40.73, 'lon' => -74.1],
+                        'bottom_right' => ['lat' => 40.01, 'lon' => -71.12],
+                    ],
+                    'parameter' => 'value',
+                ],
+            ],
+            // Case #2 (4 values).
+            [
+                'location',
+                [40.73, -74.1, 40.01, -71.12],
+                ['parameter' => 'value'],
+                [
+                    'location' => [
+                        'top' => 40.73,
+                        'left' => -74.1,
+                        'bottom' => 40.01,
+                        'right' => -71.12,
+                    ],
+                    'parameter' => 'value',
+                ],
+            ],
+        ];
+    }
+
+    /**
+     * Tests toArray method.
+     *
+     * @param string $field      Field name.
+     * @param array  $values     Bounding box values.
+     * @param array  $parameters Optional parameters.
+     * @param array  $expected   Expected result.
+     *
+     * @dataProvider getArrayDataProvider
+     */
+    public function testToArray($field, $values, $parameters, $expected)
+    {
+        $filter = new GeoBoundingBoxFilter($field, $values, $parameters);
+        $result = $filter->toArray();
+        $this->assertEquals($expected, $result);
+    }
+}
diff --git a/tests/Query/GeoDistanceQueryTest.php b/tests/Query/GeoDistanceQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..a69a4ab4eb3b71b9820ecef54028716045beaf05
--- /dev/null
+++ b/tests/Query/GeoDistanceQueryTest.php
@@ -0,0 +1,62 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Query\GeoDistanceQuery;
+
+class GeoDistanceQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Data provider for testToArray().
+     *
+     * @return array
+     */
+    public function getArrayDataProvider()
+    {
+        return [
+            // Case #1.
+            [
+                'location',
+                '200km',
+                ['lat' => 40, 'lon' => -70],
+                [],
+                ['distance' => '200km', 'location' => ['lat' => 40, 'lon' => -70]],
+            ],
+            // Case #2.
+            [
+                'location',
+                '20km',
+                ['lat' => 0, 'lon' => 0],
+                ['parameter' => 'value'],
+                ['distance' => '20km', 'location' => ['lat' => 0, 'lon' => 0], 'parameter' => 'value'],
+            ],
+        ];
+    }
+
+    /**
+     * Tests toArray() method.
+     *
+     * @param string $field      Field name.
+     * @param string $distance   Distance.
+     * @param array  $location   Location.
+     * @param array  $parameters Optional parameters.
+     * @param array  $expected   Expected result.
+     *
+     * @dataProvider getArrayDataProvider
+     */
+    public function testToArray($field, $distance, $location, $parameters, $expected)
+    {
+        $query = new GeoDistanceQuery($field, $distance, $location, $parameters);
+        $result = $query->toArray();
+        $this->assertEquals($expected, $result);
+    }
+}
diff --git a/tests/Query/GeoDistanceRangeQueryTest.php b/tests/Query/GeoDistanceRangeQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..d8e5227cd3ec066747248cf525867c73f79d99b5
--- /dev/null
+++ b/tests/Query/GeoDistanceRangeQueryTest.php
@@ -0,0 +1,62 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Query\GeoDistanceRangeQuery;
+
+class GeoDistanceRangeQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Data provider to testToArray.
+     *
+     * @return array
+     */
+    public function getArrayDataProvider()
+    {
+        return [
+            // Case #1.
+            [
+                'location',
+                ['from' => '200km', 'to' => '400km'],
+                ['lat' => 40, 'lon' => -70],
+                [],
+                ['from' => '200km', 'to' => '400km', 'location' => ['lat' => 40, 'lon' => -70]],
+            ],
+            // Case #2.
+            [
+                'location',
+                ['from' => '150km', 'to' => '180km'],
+                ['lat' => 0, 'lon' => 0],
+                ['parameter' => 'value'],
+                ['from' => '150km', 'to' => '180km', 'location' => ['lat' => 0, 'lon' => 0], 'parameter' => 'value'],
+            ],
+        ];
+    }
+
+    /**
+     * Tests toArray method.
+     *
+     * @param string $field      Field name.
+     * @param array  $range      Distance range.
+     * @param array  $location   Location.
+     * @param array  $parameters Optional parameters.
+     * @param array  $expected   Expected result.
+     *
+     * @dataProvider getArrayDataProvider
+     */
+    public function testToArray($field, $range, $location, $parameters, $expected)
+    {
+        $query = new GeoDistanceRangeQuery($field, $range, $location, $parameters);
+        $result = $query->toArray();
+        $this->assertEquals($expected, $result);
+    }
+}
diff --git a/tests/Query/GeoPolygonQueryTest.php b/tests/Query/GeoPolygonQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..abf344f036c7969e4cdfa491be29e60a61957469
--- /dev/null
+++ b/tests/Query/GeoPolygonQueryTest.php
@@ -0,0 +1,88 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Query\GeoPolygonQuery;
+
+class GeoPolygonQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Data provider to testToArray.
+     *
+     * @return array
+     */
+    public function getArrayDataProvider()
+    {
+        return [
+            // Case #1.
+            [
+                'location',
+                [
+                    ['lat' => 20, 'lon' => -80],
+                    ['lat' => 30, 'lon' => -40],
+                    ['lat' => 70, 'lon' => -90],
+                ],
+                [],
+                [
+                    'location' => [
+                        'points' => [
+                            ['lat' => 20, 'lon' => -80],
+                            ['lat' => 30, 'lon' => -40],
+                            ['lat' => 70, 'lon' => -90],
+                        ],
+                    ],
+                ],
+            ],
+            // Case #2.
+            [
+                'location',
+                [],
+                ['parameter' => 'value'],
+                [
+                    'location' => ['points' => []],
+                    'parameter' => 'value',
+                ],
+            ],
+            // Case #3.
+            [
+                'location',
+                [
+                    ['lat' => 20, 'lon' => -80],
+                ],
+                ['parameter' => 'value'],
+                [
+                    'location' => [
+                        'points' => [['lat' => 20, 'lon' => -80]],
+                    ],
+                    'parameter' => 'value',
+                ],
+            ],
+        ];
+    }
+
+    /**
+     * Tests toArray method.
+     *
+     * @param string $field      Field name.
+     * @param array  $points     Polygon's points.
+     * @param array  $parameters Optional parameters.
+     * @param array  $expected   Expected result.
+     *
+     * @dataProvider getArrayDataProvider
+     */
+    public function testToArray($field, $points, $parameters, $expected)
+    {
+        $filter = new GeoPolygonQuery($field, $points, $parameters);
+        $result = $filter->toArray();
+        $this->assertEquals($expected, $result);
+    }
+}
diff --git a/tests/Query/GeoShapeQueryTest.php b/tests/Query/GeoShapeQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..47ac4965b3c8e462834a166a8f6190cf6b0a82e9
--- /dev/null
+++ b/tests/Query/GeoShapeQueryTest.php
@@ -0,0 +1,61 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Query\GeoShapeQuery;
+
+class GeoShapeQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Tests toArray() method.
+     */
+    public function testToArray()
+    {
+        $filter = new GeoShapeQuery(['param1' => 'value1']);
+        $filter->addShape('location', 'envelope', [[13, 53], [14, 52]]);
+
+        $expected = [
+            'location' => [
+                'shape' => [
+                    'type' => 'envelope',
+                    'coordinates' => [[13, 53], [14, 52]],
+                ],
+            ],
+            'param1' => 'value1',
+        ];
+
+        $this->assertEquals($expected, $filter->toArray());
+    }
+
+    /**
+     * Test for toArray() in case of pre-indexed shape.
+     */
+    public function testToArrayIndexed()
+    {
+        $filter = new GeoShapeQuery(['param1' => 'value1']);
+        $filter->addPreIndexedShape('location', 'DEU', 'countries', 'shapes', 'location');
+
+        $expected = [
+            'location' => [
+                'indexed_shape' => [
+                    'id' => 'DEU',
+                    'type' => 'countries',
+                    'index' => 'shapes',
+                    'path' => 'location',
+                ],
+            ],
+            'param1' => 'value1',
+        ];
+
+        $this->assertEquals($expected, $filter->toArray());
+    }
+}
diff --git a/tests/Query/GeohashCellQueryTest.php b/tests/Query/GeohashCellQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..208e09fa2c3e86ebdfda5dc34b5a5ae018b8af94
--- /dev/null
+++ b/tests/Query/GeohashCellQueryTest.php
@@ -0,0 +1,59 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Query\GeohashCellQuery;
+
+class GeohashCellQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Data provider for testToArray().
+     *
+     * @return array
+     */
+    public function getArrayDataProvider()
+    {
+        return [
+            // Case #1.
+            [
+                'location',
+                ['lat' => 40, 'lon' => -70],
+                [],
+                ['location' => ['lat' => 40, 'lon' => -70]],
+            ],
+            // Case #2.
+            [
+                'location',
+                ['lat' => 0, 'lon' => 0],
+                ['parameter' => 'value'],
+                ['location' => ['lat' => 0, 'lon' => 0], 'parameter' => 'value'],
+            ],
+        ];
+    }
+
+    /**
+     * Tests toArray() method.
+     *
+     * @param string $field      Field name.
+     * @param array  $location   Location.
+     * @param array  $parameters Optional parameters.
+     * @param array  $expected   Expected result.
+     *
+     * @dataProvider getArrayDataProvider
+     */
+    public function testToArray($field, $location, $parameters, $expected)
+    {
+        $query = new GeohashCellQuery($field, $location, $parameters);
+        $result = $query->toArray();
+        $this->assertEquals($expected, $result);
+    }
+}
diff --git a/tests/Query/HasChildQueryTest.php b/tests/Query/HasChildQueryTest.php
index a2f420563a398059ea2a07712eff7c96c53b8533..2caa3a0f0fde7aed1ff6299611909c4eba7f0acf 100644
--- a/tests/Query/HasChildQueryTest.php
+++ b/tests/Query/HasChildQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Query;
 
 use ONGR\ElasticsearchDSL\Query\HasChildQuery;
 
diff --git a/tests/Query/HasParentQueryTest.php b/tests/Query/HasParentQueryTest.php
index 6efcef5875182a77d704f604bb229af8c86c42fb..623d914451def0531666e58fb59e1677649b0b18 100644
--- a/tests/Query/HasParentQueryTest.php
+++ b/tests/Query/HasParentQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Query;
 
 use ONGR\ElasticsearchDSL\Query\HasParentQuery;
 
diff --git a/tests/Query/LimitQueryTest.php b/tests/Query/LimitQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..c2aba613f8de7c404b51508a09e81d4a57ef7b81
--- /dev/null
+++ b/tests/Query/LimitQueryTest.php
@@ -0,0 +1,27 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Query\LimitQuery;
+
+class LimitQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Test for query toArray() method.
+     */
+    public function testToArray()
+    {
+        $query = new LimitQuery(3);
+        $expectedResult = ['value' => 3];
+        $this->assertEquals($expectedResult, $query->toArray());
+    }
+}
diff --git a/tests/Query/MissingQueryTest.php b/tests/Query/MissingQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..f571aeb1a985b1ea39aafe57db3b7ce103ff8251
--- /dev/null
+++ b/tests/Query/MissingQueryTest.php
@@ -0,0 +1,48 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Query\MissingQuery;
+
+class MissingQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Data provider to testGetToArray.
+     *
+     * @return array
+     */
+    public function getArrayDataProvider()
+    {
+        return [
+            // Case 1.
+            ['user', [], ['field' => 'user']],
+            // Case 2.
+            ['user', ['existence' => true], ['field' => 'user', 'existence' => true]],
+        ];
+    }
+
+    /**
+     * Test for query toArray() method.
+     *
+     * @param string $field
+     * @param array  $parameters
+     * @param array  $expected
+     *
+     * @dataProvider getArrayDataProvider
+     */
+    public function testToArray($field, $parameters, $expected)
+    {
+        $query = new MissingQuery($field, $parameters);
+        $result = $query->toArray();
+        $this->assertEquals($expected, $result);
+    }
+}
diff --git a/tests/Query/NestedQueryTest.php b/tests/Query/NestedQueryTest.php
index abf9efa7d398cfefb0565c8f01f31d6d4615588a..6a21f7f705f6e06ca8751c54541970f3b77f735f 100644
--- a/tests/Query/NestedQueryTest.php
+++ b/tests/Query/NestedQueryTest.php
@@ -9,55 +9,62 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Query;
 
 use ONGR\ElasticsearchDSL\Query\BoolQuery;
 use ONGR\ElasticsearchDSL\Query\NestedQuery;
+use ONGR\ElasticsearchDSL\Query\TermsQuery;
 use ONGR\ElasticsearchDSL\Query\TermQuery;
 
 class NestedQueryTest extends \PHPUnit_Framework_TestCase
 {
     /**
-     * Tests toArray method.
+     * Data provider to testGetToArray.
+     *
+     * @return array
      */
-    public function testToArray()
+    public function getArrayDataProvider()
     {
-        $missingFilterMock = $this->getMockBuilder('ONGR\ElasticsearchDSL\Filter\MissingFilter')
-            ->setConstructorArgs(['test_field'])
-            ->getMock();
-        $missingFilterMock->expects($this->any())
-            ->method('getType')
-            ->willReturn('test_type');
-        $missingFilterMock->expects($this->any())
-            ->method('toArray')
-            ->willReturn(['testKey' => 'testValue']);
-
-        $result = [
-            'path' => 'test_path',
-            'query' => [
-                'test_type' => ['testKey' => 'testValue'],
+        $query = [
+            'terms' => [
+                'foo' => 'bar',
             ],
         ];
 
-        $query = new NestedQuery('test_path', $missingFilterMock);
-        $this->assertEquals($result, $query->toArray());
+        return [
+            'query_only' => [
+                'product.sub_item',
+                [],
+                ['path' => 'product.sub_item', 'query' => $query],
+            ],
+            'query_with_parameters' => [
+                'product.sub_item',
+                ['_cache' => true, '_name' => 'named_result'],
+                [
+                    'path' => 'product.sub_item',
+                    'query' => $query,
+                    '_cache' => true,
+                    '_name' => 'named_result',
+                ],
+            ],
+        ];
     }
 
     /**
-     * Tests if Nested Query has parameters.
+     * Test for query toArray() method.
+     *
+     * @param string $path
+     * @param array  $parameters
+     * @param array  $expected
+     *
+     * @dataProvider getArrayDataProvider
      */
-    public function testParameters()
+    public function testToArray($path, $parameters, $expected)
     {
-        $nestedQuery = $this->getMockBuilder('ONGR\ElasticsearchDSL\Query\NestedQuery')
-            ->disableOriginalConstructor()
-            ->setMethods(null)
-            ->getMock();
-
-        $this->assertTrue(method_exists($nestedQuery, 'addParameter'), 'Nested query must have addParameter method');
-        $this->assertTrue(method_exists($nestedQuery, 'setParameters'), 'Nested query must have setParameters method');
-        $this->assertTrue(method_exists($nestedQuery, 'getParameters'), 'Nested query must have getParameters method');
-        $this->assertTrue(method_exists($nestedQuery, 'hasParameter'), 'Nested query must have hasParameter method');
-        $this->assertTrue(method_exists($nestedQuery, 'getParameter'), 'Nested query must have getParameter method');
+        $query = new TermsQuery('foo', 'bar');
+        $query = new NestedQuery($path, $query, $parameters);
+        $result = $query->toArray();
+        $this->assertEquals($expected, $result);
     }
 
     /**
diff --git a/tests/Query/ScriptQueryTest.php b/tests/Query/ScriptQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..12aab734c835dfd916d1c9cd1477cc37a4b4c896
--- /dev/null
+++ b/tests/Query/ScriptQueryTest.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Query\ScriptQuery;
+
+class ScriptQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Data provider for testToArray().
+     *
+     * @return array
+     */
+    public function getArrayDataProvider()
+    {
+        return [
+            'simple_script' => [
+                "doc['num1'].value > 1",
+                [],
+                ['script' => ['inline' => "doc['num1'].value > 1"]],
+            ],
+            'script_with_parameters' => [
+                "doc['num1'].value > param1",
+                ['params' => ['param1' => 5]],
+                ['script' => ['inline' => "doc['num1'].value > param1", 'params' => ['param1' => 5]]],
+            ],
+        ];
+    }
+
+    /**
+     * Test for filter toArray() method.
+     *
+     * @param string $script     Script.
+     * @param array  $parameters Optional parameters.
+     * @param array  $expected   Expected values.
+     *
+     * @dataProvider getArrayDataProvider
+     */
+    public function testToArray($script, $parameters, $expected)
+    {
+        $filter = new ScriptQuery($script, $parameters);
+        $result = $filter->toArray();
+        $this->assertEquals($expected, $result);
+    }
+}
diff --git a/tests/Query/Span/SpanFirstQueryTest.php b/tests/Query/Span/SpanFirstQueryTest.php
index 9af18fb8fa08075fe16f8e1ddcb6d37328f4dff7..33122bbf05a0e526a5f89c6f9d4d220ab27c5afe 100644
--- a/tests/Query/Span/SpanFirstQueryTest.php
+++ b/tests/Query/Span/SpanFirstQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanFirstQuery;
 use ONGR\ElasticsearchDSL\Query\Span\SpanQueryInterface;
diff --git a/tests/Query/Span/SpanMultiTermQueryTest.php b/tests/Query/Span/SpanMultiTermQueryTest.php
index 59553c42988b5685396026da8901960fcb7ec227..f89c44dfeb8dedd81150fdd1fd14abc17e43b3d7 100644
--- a/tests/Query/Span/SpanMultiTermQueryTest.php
+++ b/tests/Query/Span/SpanMultiTermQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
 
 use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\Query\Span\SpanMultiTermQuery;
diff --git a/tests/Query/Span/SpanNearQueryTest.php b/tests/Query/Span/SpanNearQueryTest.php
index f01a38fd595e020fb2972b57a6eb4c37f4125030..0843dfa7cd3d6127f9aca5b83a87d04494886a3e 100644
--- a/tests/Query/Span/SpanNearQueryTest.php
+++ b/tests/Query/Span/SpanNearQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanNearQuery;
 use ONGR\ElasticsearchDSL\Query\Span\SpanQueryInterface;
diff --git a/tests/Query/Span/SpanNotQueryTest.php b/tests/Query/Span/SpanNotQueryTest.php
index e51f854c9a6d945b845bfeb09b32c8a36e4966e5..d1a227ac3aef46a506d711baa7569319a67c8010 100644
--- a/tests/Query/Span/SpanNotQueryTest.php
+++ b/tests/Query/Span/SpanNotQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanNotQuery;
 use ONGR\ElasticsearchDSL\Query\Span\SpanQueryInterface;
diff --git a/tests/Query/Span/SpanOrQueryTest.php b/tests/Query/Span/SpanOrQueryTest.php
index 856f47c0a2cd201c9963e93414a791f2fe2af70b..d41c8915bde5f058ab41c53166af8f92b28ea9e1 100644
--- a/tests/Query/Span/SpanOrQueryTest.php
+++ b/tests/Query/Span/SpanOrQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanOrQuery;
 use ONGR\ElasticsearchDSL\Query\Span\SpanQueryInterface;
diff --git a/tests/Query/Span/SpanTermQueryTest.php b/tests/Query/Span/SpanTermQueryTest.php
index 537f8621b8bdf40b8b21b3ccfab87b8e886bb5da..3220c169a94dee3a9e9fd7d0967429e6a1ce35d3 100644
--- a/tests/Query/Span/SpanTermQueryTest.php
+++ b/tests/Query/Span/SpanTermQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanTermQuery;
 
diff --git a/tests/Query/TypeQueryTest.php b/tests/Query/TypeQueryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..f0284cbff0db6f04e33d646ef84bdc23783225fb
--- /dev/null
+++ b/tests/Query/TypeQueryTest.php
@@ -0,0 +1,27 @@
+<?php
+
+/*
+ * This file is part of the ONGR package.
+ *
+ * (c) NFQ Technologies UAB <info@nfq.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace ONGR\ElasticsearchDSL\Tests\Query;
+
+use ONGR\ElasticsearchDSL\Query\TypeQuery;
+
+class TypeQueryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Test for query toArray() method.
+     */
+    public function testToArray()
+    {
+        $query = new TypeQuery('foo');
+        $expectedResult = ['value' => 'foo'];
+        $this->assertEquals($expectedResult, $query->toArray());
+    }
+}