Class: Elasticband::Aggregation::FieldBased

Inherits:
Elasticband::Aggregation show all
Defined in:
lib/elasticband/aggregation/field_based.rb

Direct Known Subclasses

Max, Terms

Constant Summary

Constants inherited from Elasticband::Aggregation

PARSE_AGGREGATIONS

Instance Attribute Summary collapse

Attributes inherited from Elasticband::Aggregation

#name

Instance Method Summary collapse

Methods inherited from Elasticband::Aggregation

merge, parse

Constructor Details

#initialize(name, field, options = {}) ⇒ FieldBased

Returns a new instance of FieldBased.



6
7
8
9
10
# 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

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



4
5
6
# File 'lib/elasticband/aggregation/field_based.rb', line 4

def field
  @field
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/elasticband/aggregation/field_based.rb', line 4

def options
  @options
end

Instance Method Details

#to_hObject



12
13
14
# File 'lib/elasticband/aggregation/field_based.rb', line 12

def to_h
  super(aggregation_hash)
end

#typeObject

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/elasticband/aggregation/field_based.rb', line 16

def type
  raise NotImplementedError
end