Skip to content

Commit

Permalink
Removed the "parent" agg
Browse files Browse the repository at this point in the history
  • Loading branch information
clintongormley committed Aug 24, 2014
1 parent 6b3452d commit 96d859a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 95 deletions.
2 changes: 1 addition & 1 deletion 404_Parent_Child.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include::404_Parent_Child/50_Has_child.asciidoc[]

include::404_Parent_Child/55_Has_parent.asciidoc[]

include::404_Parent_Child/60_Parent_child_aggs.asciidoc[]
include::404_Parent_Child/60_Children_agg.asciidoc[]

include::404_Parent_Child/65_Grandparents.asciidoc[]

Expand Down
46 changes: 46 additions & 0 deletions 404_Parent_Child/60_Children_agg.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[[children-agg]]
=== Children aggregation

coming[1.4.0]

Parent-child supports a
{ref}search-aggregations-bucket-children-aggregation.html[`children`
aggregation] as a direct analog to the `nested` aggregation discussed in
<<nested-aggregation>>. A parent aggregation (the equivalent of
`reverse_nested`) is not supported.

This example demonstrates how we could determine the favourite hobbies of our
employees by country:

[source,json]
-------------------------
GET /company/branch/_search?search_type=count
{
"aggs": {
"country": {
"terms": { <1>
"field": "country"
},
"aggs": {
"employees": {
"children": { <2>
"type": "employee"
},
"aggs": {
"hobby": {
"terms": { <3>
"field": "hobby"
}
}
}
}
}
}
}
}
-------------------------
<1> The `country` field in the `branch` documents.
<2> The `children` aggregation joins the parent documents with
their associated children of type `employee`.
<3> The `hobby` field from the `employee` child documents.

94 changes: 0 additions & 94 deletions 404_Parent_Child/60_Parent_child_aggs.asciidoc

This file was deleted.

0 comments on commit 96d859a

Please sign in to comment.