Class: Elasticated::Aggregation
- Inherits:
-
Object
- Object
- Elasticated::Aggregation
- Defined in:
- lib/elasticated/aggregation.rb
Direct Known Subclasses
CountFilteredAggregation, CustomAggregation, FilterAggregation, GeohashGridAggregation, HistogramAggregation, NestedAggregation, RangeAggregation, SingleValueAggregation, StatsAggregation, TermsAggregation, TopHitsAggregation
Instance Attribute Summary collapse
-
#alias_name ⇒ Object
Returns the value of attribute alias_name.
-
#extra_params ⇒ Object
Returns the value of attribute extra_params.
-
#field ⇒ Object
Returns the value of attribute field.
Instance Method Summary collapse
-
#initialize(field, *args, &block) ⇒ Aggregation
constructor
A new instance of Aggregation.
- #name ⇒ Object
- #original_name ⇒ Object
Methods included from Mixins::Inspectionable
Methods included from Mixins::BlockEvaluation
Methods included from Mixins::Clonable
Constructor Details
#initialize(field, *args, &block) ⇒ Aggregation
Returns a new instance of Aggregation.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/elasticated/aggregation.rb', line 25 def initialize(field, *args, &block) self.field = field opts = args.last if opts.is_a? Hash self.extra_params = Helpers.hash_deep_dup opts self.alias_name = extra_params.delete :as else self.extra_params = Hash.new end end |
Instance Attribute Details
#alias_name ⇒ Object
Returns the value of attribute alias_name.
13 14 15 |
# File 'lib/elasticated/aggregation.rb', line 13 def alias_name @alias_name end |
#extra_params ⇒ Object
Returns the value of attribute extra_params.
13 14 15 |
# File 'lib/elasticated/aggregation.rb', line 13 def extra_params @extra_params end |
#field ⇒ Object
Returns the value of attribute field.
13 14 15 |
# File 'lib/elasticated/aggregation.rb', line 13 def field @field end |
Instance Method Details
#name ⇒ Object
15 16 17 18 |
# File 'lib/elasticated/aggregation.rb', line 15 def name return Helpers.string_to_agg_name(alias_name).to_sym if alias_name Helpers.string_to_agg_name(default_name).to_sym end |
#original_name ⇒ Object
20 21 22 23 |
# File 'lib/elasticated/aggregation.rb', line 20 def original_name return alias_name.to_sym if alias_name default_name.to_s.to_sym end |