Class: Arelastic::Searches::Aggregations
- Inherits:
-
Search
- Object
- Nodes::Node
- Search
- Arelastic::Searches::Aggregations
- Defined in:
- lib/arelastic/searches/aggregations.rb
Instance Attribute Summary collapse
-
#aggregations ⇒ Object
Returns the value of attribute aggregations.
Instance Method Summary collapse
- #as_elastic ⇒ Object
-
#initialize(*aggregations) ⇒ Aggregations
constructor
A new instance of Aggregations.
- #nested(name, path) ⇒ Object
Methods inherited from Nodes::Node
Methods included from Arities::Binary
Methods included from Arities::Polyadic
Methods included from Arities::Unary
Constructor Details
#initialize(*aggregations) ⇒ Aggregations
Returns a new instance of Aggregations.
5 6 7 |
# File 'lib/arelastic/searches/aggregations.rb', line 5 def initialize *aggregations @aggregations = aggregations.flatten end |
Instance Attribute Details
#aggregations ⇒ Object
Returns the value of attribute aggregations.
4 5 6 |
# File 'lib/arelastic/searches/aggregations.rb', line 4 def aggregations @aggregations end |
Instance Method Details
#as_elastic ⇒ Object
9 10 11 12 |
# File 'lib/arelastic/searches/aggregations.rb', line 9 def as_elastic grouping = Arelastic::Nodes::HashGroup.new aggregations.flatten { "aggs" => grouping.as_elastic } end |
#nested(name, path) ⇒ Object
14 15 16 |
# File 'lib/arelastic/searches/aggregations.rb', line 14 def nested(name, path) Arelastic::Aggregations::Nested.new name, path, aggregations end |