Class: Elastic::Nodes::Agg::DateHistogram
- Includes:
- Concerns::Aggregable, Concerns::Bucketed
- Defined in:
- lib/elastic/nodes/agg/date_histogram.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#time_zone ⇒ Object
Returns the value of attribute time_zone.
Attributes inherited from BaseAgg
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Concerns::Bucketed
Methods included from Concerns::Aggregable
#aggregate, #aggregations, #aggregations=, #has_aggregations?, #traverse
Methods inherited from BaseAgg
Methods inherited from Base
#==, #handle_result, #traverse
Methods included from Support::Traversable
Constructor Details
This class inherits a constructor from Elastic::Nodes::BaseAgg
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
14 15 16 |
# File 'lib/elastic/nodes/agg/date_histogram.rb', line 14 def field @field end |
#interval ⇒ Object
Returns the value of attribute interval.
15 16 17 |
# File 'lib/elastic/nodes/agg/date_histogram.rb', line 15 def interval @interval end |
#time_zone ⇒ Object
Returns the value of attribute time_zone.
15 16 17 |
# File 'lib/elastic/nodes/agg/date_histogram.rb', line 15 def time_zone @time_zone end |
Class Method Details
.build(_name, _field, interval: nil, time_zone: nil) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/elastic/nodes/agg/date_histogram.rb', line 6 def self.build(_name, _field, interval: nil, time_zone: nil) super(_name).tap do |node| node.field = _field node.interval = interval node.time_zone = time_zone end end |
Instance Method Details
#clone ⇒ Object
27 28 29 |
# File 'lib/elastic/nodes/agg/date_histogram.rb', line 27 def clone prepare_clone(super) end |
#render(_options = {}) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/elastic/nodes/agg/date_histogram.rb', line 35 def render( = {}) hash = { 'field' => @field.to_s } hash['interval'] = @interval if @interval hash['time_zone'] = @time_zone.formatted_offset if @time_zone render_aggs({ 'date_histogram' => hash }, ) end |
#simplify ⇒ Object
31 32 33 |
# File 'lib/elastic/nodes/agg/date_histogram.rb', line 31 def simplify prepare_clone(super) end |