class Elasticband::Aggregation::FieldBased

Attributes

field[RW]
options[RW]

Public Class Methods

new(name, field, options = {}) click to toggle source
Calls superclass method Elasticband::Aggregation::new
# File lib/elasticband/aggregation/field_based.rb, line 6
def initialize(name, field, options = {})
  super(name)
  self.field = field && field.to_sym
  self.options = options
end

Public Instance Methods

to_h() click to toggle source
Calls superclass method Elasticband::Aggregation#to_h
# File lib/elasticband/aggregation/field_based.rb, line 12
def to_h
  super(aggregation_hash)
end
type() click to toggle source
# File lib/elasticband/aggregation/field_based.rb, line 16
def type
  raise NotImplementedError
end

Private Instance Methods

aggregation_hash() click to toggle source
# File lib/elasticband/aggregation/field_based.rb, line 22
def aggregation_hash
  { type => { field: field }.merge!(options).compact }
end