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