Class: Elasticated::CountFilteredAggregation
- Inherits:
-
Aggregation
- Object
- Aggregation
- Elasticated::CountFilteredAggregation
- Defined in:
- lib/elasticated/aggregations/count_filtered_aggregation.rb
Instance Attribute Summary collapse
-
#_conditions ⇒ Object
Returns the value of attribute _conditions.
-
#_filter_name ⇒ Object
Returns the value of attribute _filter_name.
Attributes inherited from Aggregation
#alias_name, #extra_params, #field
Instance Method Summary collapse
- #build ⇒ Object
- #conditions(&block) ⇒ Object
- #default_name ⇒ Object
-
#initialize(filter_name, *args, &block) ⇒ CountFilteredAggregation
constructor
A new instance of CountFilteredAggregation.
- #parse(response) ⇒ Object
Methods inherited from Aggregation
Methods included from Mixins::Inspectionable
Methods included from Mixins::BlockEvaluation
Methods included from Mixins::Clonable
Constructor Details
#initialize(filter_name, *args, &block) ⇒ CountFilteredAggregation
Returns a new instance of CountFilteredAggregation.
6 7 8 9 10 |
# File 'lib/elasticated/aggregations/count_filtered_aggregation.rb', line 6 def initialize(filter_name, *args, &block) self._conditions = QueryConditions.new self._filter_name = filter_name _conditions.evaluate block end |
Instance Attribute Details
#_conditions ⇒ Object
Returns the value of attribute _conditions.
4 5 6 |
# File 'lib/elasticated/aggregations/count_filtered_aggregation.rb', line 4 def _conditions @_conditions end |
#_filter_name ⇒ Object
Returns the value of attribute _filter_name.
4 5 6 |
# File 'lib/elasticated/aggregations/count_filtered_aggregation.rb', line 4 def _filter_name @_filter_name end |
Instance Method Details
#build ⇒ Object
20 21 22 |
# File 'lib/elasticated/aggregations/count_filtered_aggregation.rb', line 20 def build { filter: _conditions.build } end |
#conditions(&block) ⇒ Object
16 17 18 |
# File 'lib/elasticated/aggregations/count_filtered_aggregation.rb', line 16 def conditions(&block) _conditions.instance_exec &block end |
#default_name ⇒ Object
12 13 14 |
# File 'lib/elasticated/aggregations/count_filtered_aggregation.rb', line 12 def default_name _filter_name end |
#parse(response) ⇒ Object
24 25 26 |
# File 'lib/elasticated/aggregations/count_filtered_aggregation.rb', line 24 def parse(response) response['doc_count'] end |