From 9061001432415ea55dabc717adbbde92475a87a4 Mon Sep 17 00:00:00 2001
From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io>
Date: Thu, 2 Jul 2015 12:58:18 +0300
Subject: [PATCH] Add has parent query doc.

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

diff --git a/docs/Query/HasParent.md b/docs/Query/HasParent.md
new file mode 100644
index 0000000..a6a12db
--- /dev/null
+++ b/docs/Query/HasParent.md
@@ -0,0 +1,36 @@
+# Has Parent Query
+
+> More info about has parent query is in the [official elasticsearch docs][1]
+
+The has parent query 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
+
+```JSON
+{
+    "has_parent" : {
+        "parent_type" : "blog",
+        "query" : {
+            "term" : {
+                "tag" : "something"
+            }
+        }
+    }
+}
+```
+
+In DSL:
+
+```php
+$termQuery = new TermQuery('tag', 'something');
+
+$hasParentQuery = new HasParentQuery('blog', $termQuery);
+
+$search = new Search();
+$search->addQuery($hasParentQuery);
+
+$queryArray = $search->toArray();
+```
+
+[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-parent-query.html
-- 
GitLab