Class: Elasticated::FilterAggregation
- Inherits:
-
Aggregation
- Object
- Aggregation
- Elasticated::FilterAggregation
- Includes:
- Subaggregated
- Defined in:
- lib/elasticated/aggregations/filter_aggregation.rb
Instance Attribute Summary collapse
-
#_evaluator ⇒ Object
Returns the value of attribute _evaluator.
-
#_filter_name ⇒ Object
Returns the value of attribute _filter_name.
Attributes included from Subaggregated
Attributes inherited from Aggregation
#alias_name, #extra_params, #field
Instance Method Summary collapse
- #build ⇒ Object
- #default_name ⇒ Object
-
#initialize(filter_name, *args, &block) ⇒ FilterAggregation
constructor
A new instance of FilterAggregation.
- #parse(response) ⇒ Object
Methods included from Subaggregated
Methods inherited from Aggregation
Methods included from Clonable
Methods included from BlockEvaluation
Constructor Details
#initialize(filter_name, *args, &block) ⇒ FilterAggregation
Returns a new instance of FilterAggregation.
7 8 9 10 11 |
# File 'lib/elasticated/aggregations/filter_aggregation.rb', line 7 def initialize(filter_name, *args, &block) self._filter_name = filter_name super initialize_subaggregations FilterAggregationEvaluator.new, &block end |
Instance Attribute Details
#_evaluator ⇒ Object
Returns the value of attribute _evaluator.
5 6 7 |
# File 'lib/elasticated/aggregations/filter_aggregation.rb', line 5 def _evaluator @_evaluator end |
#_filter_name ⇒ Object
Returns the value of attribute _filter_name.
5 6 7 |
# File 'lib/elasticated/aggregations/filter_aggregation.rb', line 5 def _filter_name @_filter_name end |
Instance Method Details
#build ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/elasticated/aggregations/filter_aggregation.rb', line 17 def build # _subaggregations is a FilterAggregationEvaluator, so... conditions = _subaggregations.build_conditions body = { filter: conditions } body.merge! build_subaggregations body end |
#default_name ⇒ Object
13 14 15 |
# File 'lib/elasticated/aggregations/filter_aggregation.rb', line 13 def default_name _filter_name end |
#parse(response) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/elasticated/aggregations/filter_aggregation.rb', line 25 def parse(response) response_body = response ret = { 'count' => response_body['doc_count'] } ret.merge! parse_subaggregations(response_body) ret end |