|
| 1 | +:ref_current: https://www.elastic.co/guide/en/elasticsearch/reference/master |
| 2 | + |
| 3 | +:github: https://github.com/elastic/elasticsearch-net |
| 4 | + |
| 5 | +:nuget: https://www.nuget.org/packages |
| 6 | + |
| 7 | +//// |
| 8 | +IMPORTANT NOTE |
| 9 | +============== |
| 10 | +This file has been generated from https://github.com/elastic/elasticsearch-net/tree/master/src/Tests/Tests/Aggregations/Bucket/DiversifiedSampler/DiversifiedSamplerAggregationUsageTests.cs. |
| 11 | +If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file, |
| 12 | +please modify the original csharp file found at the link and submit the PR with that change. Thanks! |
| 13 | +//// |
| 14 | + |
| 15 | +[[diversified-sampler-aggregation-usage]] |
| 16 | +=== Diversified Sampler Aggregation Usage |
| 17 | + |
| 18 | +==== Fluent DSL example |
| 19 | + |
| 20 | +[source,csharp] |
| 21 | +---- |
| 22 | +a => a |
| 23 | +.DiversifiedSampler("diversified_sample", sm => sm |
| 24 | + .ExecutionHint(DiversifiedSamplerAggregationExecutionHint.GlobalOrdinals) |
| 25 | + .Field(doc => doc.Type) |
| 26 | + .MaxDocsPerValue(10) |
| 27 | + .ShardSize(200) |
| 28 | + .Aggregations(aa => aa |
| 29 | + .SignificantTerms("significant_names", st => st |
| 30 | + .Field(p => p.Name) |
| 31 | + ) |
| 32 | + ) |
| 33 | +) |
| 34 | +---- |
| 35 | + |
| 36 | +==== Object Initializer syntax example |
| 37 | + |
| 38 | +[source,csharp] |
| 39 | +---- |
| 40 | +new DiversifiedSamplerAggregation("diversified_sample") |
| 41 | +{ |
| 42 | + ExecutionHint = DiversifiedSamplerAggregationExecutionHint.GlobalOrdinals, |
| 43 | + Field = new Field("type"), |
| 44 | + MaxDocsPerValue = 10, |
| 45 | + ShardSize = 200, |
| 46 | + Aggregations = new SignificantTermsAggregation("significant_names") |
| 47 | + { |
| 48 | + Field = "name" |
| 49 | + } |
| 50 | +} |
| 51 | +---- |
| 52 | + |
| 53 | +[source,javascript] |
| 54 | +.Example json output |
| 55 | +---- |
| 56 | +{ |
| 57 | + "diversified_sample": { |
| 58 | + "diversified_sampler": { |
| 59 | + "execution_hint": "global_ordinals", |
| 60 | + "field": "type", |
| 61 | + "max_docs_per_value": 10, |
| 62 | + "shard_size": 200 |
| 63 | + }, |
| 64 | + "aggs": { |
| 65 | + "significant_names": { |
| 66 | + "significant_terms": { |
| 67 | + "field": "name" |
| 68 | + } |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | +} |
| 73 | +---- |
| 74 | + |
0 commit comments