IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Sampler Aggregation Usage
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Sampler Aggregation Usage
editFluent DSL example
edita => a
.Sampler("sample", sm => sm
.ShardSize(200)
.Aggregations(aa => aa
.SignificantTerms("significant_names", st => st
.Field(p => p.Name)
)
)
)
Object Initializer syntax example
editnew SamplerAggregation("sample")
{
ShardSize = 200,
Aggregations = new SignificantTermsAggregation("significant_names")
{
Field = "name"
}
}
Example json output.
{
"sample": {
"sampler": {
"shard_size": 200
},
"aggs": {
"significant_names": {
"significant_terms": {
"field": "name"
}
}
}
}
}
Handling Responses
editresponse.ShouldBeValid();
var sample = response.Aggregations.Sampler("sample");
sample.Should().NotBeNull();
var sigTags = sample.SignificantTerms("significant_names");
sigTags.Should().NotBeNull();
sigTags.DocCount.Should().BeGreaterThan(0);
if (TestConfiguration.Instance.InRange(">=5.5.0"))
sigTags.BgCount.Should().BeGreaterThan(0);