IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Children Aggregation Usage
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Children Aggregation Usage
editA 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 example
edita => 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 example
editnew 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" } } } } }
Was this helpful?
Thank you for your feedback.