From 326016f8dd7c63c78a38b054209fdf698664707a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mantas=20Marcinkevi=C4=8Dius?= <marc.mantas@gmail.com>
Date: Thu, 1 Sep 2016 17:09:50 +0300
Subject: [PATCH] added docs for parent inner hit

---
 docs/InnerHits/Parent.md | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 docs/InnerHits/Parent.md

diff --git a/docs/InnerHits/Parent.md b/docs/InnerHits/Parent.md
new file mode 100644
index 0000000..f6d27a2
--- /dev/null
+++ b/docs/InnerHits/Parent.md
@@ -0,0 +1,39 @@
+# Parent Inner Hits
+
+> More info about inner hits is in the [official elasticsearch docs][1]
+
+The `parent/child` inner_hits can be used to include parent or child. 
+The usage of parent inner hits is very similar to that of nested [inner hits](Nested.md), the only
+difference is that in stead of passing the `path` to the nested object, the parent/child `type` 
+needs to be passed to the `$path` variable. 
+
+## Simple example
+
+```JSON
+{
+    "inner_hits" : {
+        "children" : {
+            "type" : {
+                "article" : {
+                    "query" : {
+                        "match" : {"title" : "[actual query]"}
+                    }
+                }
+            }
+        }
+    }
+}
+```
+
+And now the query via DSL:
+
+```php
+$matchQuery = new MatchQuery('title', '[actual query]');
+$innerHit = new ParentInnerHit('children', 'article', $matchQuery);
+
+$search = new Search();
+$search->addInnerHit($innerHit);
+$search->toArray();
+```
+
+[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html
-- 
GitLab