A newer version is available. For the latest information, see the
current release documentation.
Children Aggregation Usageedit
A special single bucket aggregation that enables aggregating from buckets on parent document types to buckets on child documents.
Be sure to read the Elasticsearch documentation on Children Aggregation
Fluent DSL exampleedit
a => a .Children<CommitActivity>("name_of_child_agg", child => child .Aggregations(childAggs => childAggs .Average("average_per_child", avg => avg.Field(p => p.ConfidenceFactor)) .Max("max_per_child", avg => avg.Field(p => p.ConfidenceFactor)) .Min("min_per_child", avg => avg.Field(p => p.ConfidenceFactor)) ) )
Object Initializer syntax exampleedit
new ChildrenAggregation("name_of_child_agg", typeof(CommitActivity)) { Aggregations = new AverageAggregation("average_per_child", "confidenceFactor") && new MaxAggregation("max_per_child", "confidenceFactor") && new MinAggregation("min_per_child", "confidenceFactor") }
Example json output.
{ "name_of_child_agg": { "children": { "type": "commits" }, "aggs": { "average_per_child": { "avg": { "field": "confidenceFactor" } }, "max_per_child": { "max": { "field": "confidenceFactor" } }, "min_per_child": { "min": { "field": "confidenceFactor" } } } } }