Class: Elasticband::Aggregation::Nested
- Inherits:
-
Elasticband::Aggregation
- Object
- Elasticband::Aggregation
- Elasticband::Aggregation::Nested
- Defined in:
- lib/elasticband/aggregation/nested.rb
Constant Summary
Constants inherited from Elasticband::Aggregation
Instance Attribute Summary collapse
-
#nested_aggregations ⇒ Object
Returns the value of attribute nested_aggregations.
-
#root_aggregation ⇒ Object
Returns the value of attribute root_aggregation.
Attributes inherited from Elasticband::Aggregation
Instance Method Summary collapse
-
#initialize(root_aggregation, nested_aggregations) ⇒ Nested
constructor
A new instance of Nested.
- #to_h ⇒ Object
Methods inherited from Elasticband::Aggregation
Constructor Details
#initialize(root_aggregation, nested_aggregations) ⇒ Nested
Returns a new instance of Nested.
6 7 8 9 |
# 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 |
Instance Attribute Details
#nested_aggregations ⇒ Object
Returns the value of attribute nested_aggregations.
4 5 6 |
# File 'lib/elasticband/aggregation/nested.rb', line 4 def nested_aggregations @nested_aggregations end |
#root_aggregation ⇒ Object
Returns the value of attribute root_aggregation.
4 5 6 |
# File 'lib/elasticband/aggregation/nested.rb', line 4 def root_aggregation @root_aggregation end |
Instance Method Details
#to_h ⇒ Object
11 12 13 14 15 |
# 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 |