From 49dc086aa9dc9f9e054c56afb2d954ed6af89461 Mon Sep 17 00:00:00 2001
From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io>
Date: Tue, 7 Jul 2015 17:29:20 +0300
Subject: [PATCH] Add has parent filter doc.

---
 docs/Filter/HasParent.md | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 docs/Filter/HasParent.md

diff --git a/docs/Filter/HasParent.md b/docs/Filter/HasParent.md
new file mode 100644
index 0000000..23f6de0
--- /dev/null
+++ b/docs/Filter/HasParent.md
@@ -0,0 +1,38 @@
+# Has Parent Filter
+
+> More info about has parent filter is in the [official elasticsearch docs][1]
+
+The has parent filter accepts a query and a parent type.
+The query is executed in the parent document space, which is specified by the parent type.
+This filter returns child documents which associated parents have matched.
+
+## Simple example
+
+{
+    "has_child" : {
+        "type" : "blog_tag",
+        "query" : {
+            "term" : {
+                "tag" : "something"
+            }
+        }
+    }
+}
+```
+
+And now the query via DSL:
+
+```php
+$termQuery = new TermQuery('tag', 'something');
+$hasParentFilter = new HasParentFilter(
+    'blog',
+    $termQuery
+);
+
+$search = new Search();
+$search->addFilter($hasParentFilter);
+
+$queryArray = $search->toArray();
+```
+
+[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-parent-filter.html
-- 
GitLab