Class: Noiseless::AST::Aggregation
- Defined in:
- lib/noiseless/ast/aggregation.rb
Constant Summary collapse
- METRIC_TYPES =
%i[avg sum min max cardinality value_count stats extended_stats percentiles].freeze
- BUCKET_TYPES =
%i[terms histogram date_histogram range date_range filter filters nested].freeze
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#sub_aggregations ⇒ Object
readonly
Returns the value of attribute sub_aggregations.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #add_sub_aggregation(aggregation) ⇒ Object
- #bucket? ⇒ Boolean
-
#initialize(name, type, field: nil, sub_aggregations: [], **options) ⇒ Aggregation
constructor
A new instance of Aggregation.
- #metric? ⇒ Boolean
Methods inherited from Node
Constructor Details
#initialize(name, type, field: nil, sub_aggregations: [], **options) ⇒ Aggregation
Returns a new instance of Aggregation.
11 12 13 14 15 16 17 18 |
# File 'lib/noiseless/ast/aggregation.rb', line 11 def initialize(name, type, field: nil, sub_aggregations: [], **) super() @name = name.to_s @type = type.to_sym @field = field&.to_s @options = @sub_aggregations = sub_aggregations end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
6 7 8 |
# File 'lib/noiseless/ast/aggregation.rb', line 6 def field @field end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/noiseless/ast/aggregation.rb', line 6 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/noiseless/ast/aggregation.rb', line 6 def @options end |
#sub_aggregations ⇒ Object (readonly)
Returns the value of attribute sub_aggregations.
6 7 8 |
# File 'lib/noiseless/ast/aggregation.rb', line 6 def sub_aggregations @sub_aggregations end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/noiseless/ast/aggregation.rb', line 6 def type @type end |
Instance Method Details
#add_sub_aggregation(aggregation) ⇒ Object
28 29 30 |
# File 'lib/noiseless/ast/aggregation.rb', line 28 def add_sub_aggregation(aggregation) @sub_aggregations << aggregation end |
#bucket? ⇒ Boolean
24 25 26 |
# File 'lib/noiseless/ast/aggregation.rb', line 24 def bucket? BUCKET_TYPES.include?(@type) end |
#metric? ⇒ Boolean
20 21 22 |
# File 'lib/noiseless/ast/aggregation.rb', line 20 def metric? METRIC_TYPES.include?(@type) end |