Skip to content

Commit

Permalink
Removed unsupported fields from Sampler aggregation
Browse files Browse the repository at this point in the history
Both `max_docs_per_value` as well as `execution_hint` no longer exist in
v7.

Close #1251
  • Loading branch information
olivere committed Sep 22, 2021
1 parent 9f6409a commit 9005e28
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions search_aggs_bucket_sampler.go
Expand Up @@ -14,15 +14,12 @@ type SamplerAggregation struct {
subAggregations map[string]Aggregation
meta map[string]interface{}

shardSize int
maxDocsPerValue int
executionHint string
shardSize int
}

func NewSamplerAggregation() *SamplerAggregation {
return &SamplerAggregation{
shardSize: -1,
maxDocsPerValue: -1,
subAggregations: make(map[string]Aggregation),
}
}
Expand All @@ -44,16 +41,6 @@ func (a *SamplerAggregation) ShardSize(shardSize int) *SamplerAggregation {
return a
}

func (a *SamplerAggregation) MaxDocsPerValue(maxDocsPerValue int) *SamplerAggregation {
a.maxDocsPerValue = maxDocsPerValue
return a
}

func (a *SamplerAggregation) ExecutionHint(hint string) *SamplerAggregation {
a.executionHint = hint
return a
}

func (a *SamplerAggregation) Source() (interface{}, error) {
// Example:
// {
Expand Down Expand Up @@ -82,12 +69,6 @@ func (a *SamplerAggregation) Source() (interface{}, error) {
if a.shardSize >= 0 {
opts["shard_size"] = a.shardSize
}
if a.maxDocsPerValue >= 0 {
opts["max_docs_per_value"] = a.maxDocsPerValue
}
if a.executionHint != "" {
opts["execution_hint"] = a.executionHint
}

// AggregationBuilder (SubAggregations)
if len(a.subAggregations) > 0 {
Expand Down

0 comments on commit 9005e28

Please sign in to comment.