Class: Elasticated::SumDistinctAggregation
- Inherits:
-
GroupAggregation
- Object
- Aggregation
- TermsAggregation
- GroupAggregation
- Elasticated::SumDistinctAggregation
- Defined in:
- lib/elasticated/aggregations/sum_distinct_aggregation.rb
Instance Attribute Summary collapse
-
#_operation ⇒ Object
warning! this “thing” extends from a multi-value aggregation but is a single-value!.
Attributes inherited from GroupAggregation
Attributes included from Subaggregated
Attributes inherited from TermsAggregation
#order_field, #order_method, #size
Attributes inherited from Aggregation
#alias_name, #extra_params, #field
Instance Method Summary collapse
-
#initialize(group_field, operation_type, operation_field, *args) ⇒ SumDistinctAggregation
constructor
A new instance of SumDistinctAggregation.
- #parse(response) ⇒ Object
Methods inherited from GroupAggregation
Methods included from Subaggregated
Methods inherited from TermsAggregation
Methods inherited from Aggregation
Methods included from Mixins::Inspectionable
Methods included from Mixins::BlockEvaluation
Methods included from Mixins::Clonable
Constructor Details
#initialize(group_field, operation_type, operation_field, *args) ⇒ SumDistinctAggregation
Returns a new instance of SumDistinctAggregation.
7 8 9 10 |
# File 'lib/elasticated/aggregations/sum_distinct_aggregation.rb', line 7 def initialize(group_field, operation_type, operation_field, *args) super group_field, *args self._operation = _subaggregations.send operation_type, operation_field end |
Instance Attribute Details
#_operation ⇒ Object
warning! this “thing” extends from a multi-value aggregation but is a single-value!
5 6 7 |
# File 'lib/elasticated/aggregations/sum_distinct_aggregation.rb', line 5 def _operation @_operation end |
Instance Method Details
#parse(response) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/elasticated/aggregations/sum_distinct_aggregation.rb', line 12 def parse(response) response['buckets'].inject(0) do |total, element| operation_name = _operation.name.to_s # TODO total += _subaggregations.parse(element)[operation_name] || 0 end || 0 end |