class Elasticband::Aggregation::Nested
Attributes
nested_aggregations[RW]
root_aggregation[RW]
Public Class Methods
new(root_aggregation, nested_aggregations)
click to toggle source
# File lib/elasticband/aggregation/nested.rb, line 6 def initialize(root_aggregation, nested_aggregations) self.root_aggregation = root_aggregation self.nested_aggregations = Array.wrap(nested_aggregations) end
Public Instance Methods
to_h()
click to toggle source
# File lib/elasticband/aggregation/nested.rb, line 11 def to_h root_aggregation.to_h.tap do |h| h[root_aggregation.name].merge!(aggs: nested_hash) end end
Private Instance Methods
nested_hash()
click to toggle source
# File lib/elasticband/aggregation/nested.rb, line 19 def nested_hash self.class.merge(*nested_aggregations) end