Class: Elasticated::CountAggregation
- Inherits:
-
TermsAggregation
- Object
- Aggregation
- TermsAggregation
- Elasticated::CountAggregation
- Defined in:
- lib/elasticated/aggregations/count_aggregation.rb
Instance Attribute Summary
Attributes inherited from TermsAggregation
#order_field, #order_method, #size
Attributes inherited from Aggregation
#alias_name, #extra_params, #field
Instance Method Summary collapse
Methods inherited from TermsAggregation
Methods inherited from Aggregation
#initialize, #name, #original_name
Methods included from Clonable
Methods included from BlockEvaluation
Constructor Details
This class inherits a constructor from Elasticated::TermsAggregation
Instance Method Details
#default_name ⇒ Object
4 5 6 |
# File 'lib/elasticated/aggregations/count_aggregation.rb', line 4 def default_name "count_by_#{field}" end |
#parse(response) ⇒ Object
8 9 10 11 12 |
# File 'lib/elasticated/aggregations/count_aggregation.rb', line 8 def parse(response) response['buckets'].inject({}) do |hash, bucket| hash.merge bucket['key'] => bucket['doc_count'] end end |