Class: Elastic::Results::Bucket

Inherits:
Aggregations show all
Defined in:
lib/elastic/results/bucket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Aggregations

#[], #each, #traverse

Methods inherited from Base

#traverse

Methods included from Support::Traversable

#pick_nodes, #traverse

Constructor Details

#initialize(_key, _total, _aggs) ⇒ Bucket

Returns a new instance of Bucket.



5
6
7
8
9
# File 'lib/elastic/results/bucket.rb', line 5

def initialize(_key, _total, _aggs)
  @key = _key
  @total = _total
  super _aggs
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



3
4
5
# File 'lib/elastic/results/bucket.rb', line 3

def key
  @key
end

#totalObject (readonly)

Returns the value of attribute total.



3
4
5
# File 'lib/elastic/results/bucket.rb', line 3

def total
  @total
end

Instance Method Details

#as_valueObject



11
12
13
14
# File 'lib/elastic/results/bucket.rb', line 11

def as_value
  # TODO: return aggregation value if configured as single bucket
  self
end