Diversified Sampler Aggregation Usage

edit

Fluent DSL example

edit
a => a
.DiversifiedSampler("diversified_sample", sm => sm
    .ExecutionHint(DiversifiedSamplerAggregationExecutionHint.GlobalOrdinals)
    .Field(doc => doc.Type)
    .MaxDocsPerValue(10)
    .ShardSize(200)
    .Aggregations(aa => aa
        .SignificantTerms("significant_names", st => st
            .Field(p => p.Name)
        )
    )
)

Object Initializer syntax example

edit
new DiversifiedSamplerAggregation("diversified_sample")
{
    ExecutionHint = DiversifiedSamplerAggregationExecutionHint.GlobalOrdinals,
    Field = new Field("type"),
    MaxDocsPerValue = 10,
    ShardSize = 200,
    Aggregations = new SignificantTermsAggregation("significant_names")
    {
        Field = "name"
    }
}

Example json output.

{
  "diversified_sample": {
    "diversified_sampler": {
      "execution_hint": "global_ordinals",
      "field": "type",
      "max_docs_per_value": 10,
      "shard_size": 200
    },
    "aggs": {
      "significant_names": {
        "significant_terms": {
          "field": "name"
        }
      }
    }
  }
}