Class: JayAPI::Elasticsearch::QueryBuilder::Aggregations::Avg
- Inherits:
-
Aggregation
- Object
- Aggregation
- JayAPI::Elasticsearch::QueryBuilder::Aggregations::Avg
- Defined in:
- lib/jay_api/elasticsearch/query_builder/aggregations/avg.rb
Overview
Represents an avg
aggregation in Elasticsearch. Information on this type of aggregation can be found here: www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-avg-aggregation.html
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#missing ⇒ Object
readonly
Returns the value of attribute missing.
Attributes inherited from Aggregation
Instance Method Summary collapse
- #aggs ⇒ Object
-
#clone ⇒ self
A copy of the receiver.
-
#initialize(name, field:, missing: nil) ⇒ Avg
constructor
A new instance of Avg.
-
#to_h ⇒ Hash
The Hash representation of the
Aggregation
.
Constructor Details
#initialize(name, field:, missing: nil) ⇒ Avg
Returns a new instance of Avg.
22 23 24 25 26 27 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/avg.rb', line 22 def initialize(name, field:, missing: nil) super(name) @field = field @missing = missing end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/avg.rb', line 13 def field @field end |
#missing ⇒ Object (readonly)
Returns the value of attribute missing.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/avg.rb', line 13 def missing @missing end |
Instance Method Details
#aggs ⇒ Object
31 32 33 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/avg.rb', line 31 def aggs no_nested_aggregations('Avg') end |
#clone ⇒ self
Returns A copy of the receiver.
36 37 38 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/avg.rb', line 36 def clone self.class.new(name, field: field, missing: missing) end |
#to_h ⇒ Hash
Returns The Hash representation of the Aggregation
. Properly formatted for Elasticsearch.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/avg.rb', line 42 def to_h super do { avg: { field: field, missing: missing }.compact } end end |