From 82ede7e980d2dd27204aed98a051ed70b3edfc75 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Tue, 7 Jul 2015 17:29:02 +0300 Subject: [PATCH] Add has child doc. --- docs/Filter/HasChild.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docs/Filter/HasChild.md diff --git a/docs/Filter/HasChild.md b/docs/Filter/HasChild.md new file mode 100644 index 0000000..12228b1 --- /dev/null +++ b/docs/Filter/HasChild.md @@ -0,0 +1,37 @@ +# Has Child Filter + +> More info about has child filter is in the [official elasticsearch docs][1] + +The has child filter accepts a query and the child type to run against, +and results in parent documents that have child docs matching the query. + +## Simple example + +{ + "has_child" : { + "type" : "blog_tag", + "query" : { + "term" : { + "tag" : "something" + } + } + } +} +``` + +And now the query via DSL: + +```php +$termQuery = new TermQuery('tag', 'something'); +$hasChildFilter = new HasChildFilter( + 'blog_tag', + $termQuery +); + +$search = new Search(); +$search->addFilter($hasChildFilter); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-child-filter.html -- GitLab