Class: Elastic::Nodes::Agg::BaseMetric
- Inherits:
-
BaseAgg
show all
- Defined in:
- lib/elastic/nodes/agg/base_metric.rb
Instance Attribute Summary collapse
Attributes inherited from BaseAgg
#name
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseAgg
#initialize
Methods inherited from Base
#==, #traverse
#pick_nodes, #traverse
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
10
11
12
|
# File 'lib/elastic/nodes/agg/base_metric.rb', line 10
def field
@field
end
|
#missing ⇒ Object
Returns the value of attribute missing.
10
11
12
|
# File 'lib/elastic/nodes/agg/base_metric.rb', line 10
def missing
@missing
end
|
Class Method Details
.build(_name, _field, missing: nil) ⇒ Object
3
4
5
6
7
8
|
# File 'lib/elastic/nodes/agg/base_metric.rb', line 3
def self.build(_name, _field, missing: nil)
super(_name).tap do |node|
node.field = _field
node.missing = missing
end
end
|
Instance Method Details
#clone ⇒ Object
12
13
14
|
# File 'lib/elastic/nodes/agg/base_metric.rb', line 12
def clone
prepare_clone super
end
|
#handle_result(_raw, _formatter) ⇒ Object
27
28
29
30
|
# File 'lib/elastic/nodes/agg/base_metric.rb', line 27
def handle_result(_raw, _formatter)
Elastic::Results::Metric.new _raw['value']
end
|
#render(_options = {}) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/elastic/nodes/agg/base_metric.rb', line 20
def render(_options = {})
hash = { 'field' => @field.to_s }
hash['missing'] = @missing if @missing
{ metric => hash }
end
|
#simplify ⇒ Object
16
17
18
|
# File 'lib/elastic/nodes/agg/base_metric.rb', line 16
def simplify
prepare_clone super
end
|