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

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))
    )
)
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"
        }
      }
    }
  }
}