You are looking at preliminary documentation for a future release.
Not what you want? See the
current release documentation.
Sampler Aggregation Usageedit
Fluent DSL Exampleedit
s => s
.Aggregations(aggs => aggs
.Sampler("sample", sm => sm
.ShardSize(200)
.Aggregations(aa => aa
.SignificantTerms("significant_names", st => st
.Field(p => p.Name)
)
)
)
)Object Initializer Syntax Exampleedit
new SearchRequest<Project>
{
Aggregations = new SamplerAggregation("sample")
{
ShardSize = 200,
Aggregations = new SignificantTermsAggregation("significant_names")
{
Field = "name"
}
}
}Example json output.
{
"aggs": {
"sample": {
"sampler": {
"shard_size": 200
},
"aggs": {
"significant_names": {
"significant_terms": {
"field": "name"
}
}
}
}
}
}
Handling Responsesedit
response.ShouldBeValid();
var sample = response.Aggs.Sampler("sample");
sample.Should().NotBeNull();
var sigTags = sample.SignificantTerms("significant_names");
sigTags.Should().NotBeNull();