Class: Elasticated::SingleValueAggregation
- Inherits:
-
Aggregation
- Object
- Aggregation
- Elasticated::SingleValueAggregation
- Defined in:
- lib/elasticated/aggregations/single_value_aggregation.rb
Direct Known Subclasses
AvgAggregation, CardinalityAggregation, MaxAggregation, MinAggregation, MissingAggregation, SumAggregation, ValueCountAggregation
Instance Attribute Summary
Attributes inherited from Aggregation
#alias_name, #extra_params, #field
Instance Method Summary collapse
- #build ⇒ Object
-
#default_name ⇒ Object
abstract class child must implement operation().
- #parse(response) ⇒ Object
Methods inherited from Aggregation
#initialize, #name, #original_name
Methods included from Mixins::Inspectionable
Methods included from Mixins::BlockEvaluation
Methods included from Mixins::Clonable
Constructor Details
This class inherits a constructor from Elasticated::Aggregation
Instance Method Details
#build ⇒ Object
11 12 13 14 15 |
# File 'lib/elasticated/aggregations/single_value_aggregation.rb', line 11 def build operation_info = { field: field } operation_info.merge! extra_params { operation => operation_info } end |
#default_name ⇒ Object
abstract class child must implement operation()
7 8 9 |
# File 'lib/elasticated/aggregations/single_value_aggregation.rb', line 7 def default_name "#{operation}_#{field}" end |
#parse(response) ⇒ Object
17 18 19 |
# File 'lib/elasticated/aggregations/single_value_aggregation.rb', line 17 def parse(response) response[result_key] || 0 end |