Class: Arelastic::Aggregations::Aggregation
- Inherits:
-
Nodes::Node
- Object
- Nodes::Node
- Arelastic::Aggregations::Aggregation
- Defined in:
- lib/arelastic/aggregations/aggregation.rb
Direct Known Subclasses
Bucket, BucketSelector, BucketSort, Cardinality, Max, Min, Sum, ValueCount
Instance Attribute Summary collapse
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #as_elastic ⇒ Object
-
#initialize(name, options = {}) ⇒ Aggregation
constructor
A new instance of Aggregation.
- #nested(path) ⇒ Object
- #reverse_nested(path = nil) ⇒ Object
Methods inherited from Nodes::Node
#==, #convert_to_elastic, #hash, #read_option!
Methods included from Arelastic::Arities::Binary
Methods included from Arelastic::Arities::Polyadic
Methods included from Arelastic::Arities::Unary
Constructor Details
#initialize(name, options = {}) ⇒ Aggregation
Returns a new instance of Aggregation.
6 7 8 9 10 11 12 |
# File 'lib/arelastic/aggregations/aggregation.rb', line 6 def initialize(name, = {}) @name = name = .dup @meta = read_option! , 'meta' @options = end |
Instance Attribute Details
#meta ⇒ Object
Returns the value of attribute meta.
4 5 6 |
# File 'lib/arelastic/aggregations/aggregation.rb', line 4 def @meta end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/arelastic/aggregations/aggregation.rb', line 4 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/arelastic/aggregations/aggregation.rb', line 4 def @options end |
Instance Method Details
#as_elastic ⇒ Object
14 15 16 17 18 |
# File 'lib/arelastic/aggregations/aggregation.rb', line 14 def as_elastic params = as_elastic_aggregation params['meta'] = if {name => params} end |
#nested(path) ⇒ Object
20 21 22 |
# File 'lib/arelastic/aggregations/aggregation.rb', line 20 def nested(path) Arelastic::Aggregations::Nested.new(name, path, [self]) end |
#reverse_nested(path = nil) ⇒ Object
24 25 26 |
# File 'lib/arelastic/aggregations/aggregation.rb', line 24 def reverse_nested(path = nil) Arelastic::Aggregations::ReverseNested.new(name, path, [self]) end |