WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Sampler Aggregation Usage
editSampler Aggregation Usage
editFluent DSL example
edits => s .Aggregations(aggs => aggs .Sampler("sample", sm => sm .ShardSize(200) .Field(p => p.Name) .Aggregations(aa => aa .SignificantTerms("significant_names", st => st .Field(p => p.Name) ) ) ) )
Object Initializer syntax example
editnew SearchRequest<Project> { Aggregations = new SamplerAggregation("sample") { ShardSize = 200, Field = "name", Aggregations = new SignificantTermsAggregation("significant_names") { Field = "name" } } }
Example json output.
{ "aggs": { "sample": { "sampler": { "shard_size": 200, "field": "name" }, "aggs": { "significant_names": { "significant_terms": { "field": "name" } } } } } }
Handling Responses
editresponse.ShouldBeValid(); var sample = response.Aggs.Sampler("sample"); sample.Should().NotBeNull(); var sigTags = sample.SignificantTerms("significant_names"); sigTags.Should().NotBeNull();