You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Value Count aggregationedit
A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents.
Fluent DSLedit
var result = client.Search<ElasticsearchProject>(s => s
.Aggregations(a => a
.ValueCount("my_valuecount_agg", v => v
.Field(p => p.Followers.First().Age)
)
)
);
var agg = result.Aggs.ValueCount("my_valuecount_agg");Object Initializer Syntaxedit
var request = new SearchRequest
{
Aggregations = new Dictionary<string, IAggregationContainer>
{
{ "my_valuecount_agg", new AggregationContainer
{
ValueCount = new ValueCountAggregator
{
Field = "followers.age"
}
}
}
}
};
var result = client.Search<ElasticsearchProject>(request);
var agg = result.Aggs.ValueCount("my_valuecount_agg");Refer to the original docs for more information.