Class: Elasticated::NestedAggregation
Instance Attribute Summary collapse
#_subaggregations
Attributes inherited from Aggregation
#alias_name, #extra_params, #field
Instance Method Summary
collapse
#initialize_subaggregations
Methods inherited from Aggregation
#name, #original_name
Methods included from Clonable
#==, #clone
#evaluate
Constructor Details
#initialize(path, *args, &block) ⇒ 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
|