Class: JayAPI::Elasticsearch::QueryBuilder::Aggregations::Sum
- Inherits:
-
Aggregation
- Object
- Aggregation
- JayAPI::Elasticsearch::QueryBuilder::Aggregations::Sum
- Defined in:
- lib/jay_api/elasticsearch/query_builder/aggregations/sum.rb
Overview
Represents a sum
aggregation in Elasticsearch. Information on this type of aggregation can be found here: www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-sum-aggregation.html
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
TODO: Add script support to the aggregation.
-
#missing ⇒ Object
readonly
TODO: Add script support to the aggregation.
Attributes inherited from Aggregation
Instance Method Summary collapse
- #aggs ⇒ Object
-
#clone ⇒ self
A copy of the receiver.
-
#initialize(name, field:, missing: nil) ⇒ Sum
constructor
A new instance of Sum.
-
#to_h ⇒ Hash
The Hash representation of the
Aggregation
.
Constructor Details
#initialize(name, field:, missing: nil) ⇒ Sum
Returns a new instance of Sum.
23 24 25 26 27 28 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/sum.rb', line 23 def initialize(name, field:, missing: nil) super(name) @field = field @missing = missing end |
Instance Attribute Details
#field ⇒ Object (readonly)
TODO: Add script support to the aggregation
15 16 17 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/sum.rb', line 15 def field @field end |
#missing ⇒ Object (readonly)
TODO: Add script support to the aggregation
15 16 17 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/sum.rb', line 15 def missing @missing end |
Instance Method Details
#aggs ⇒ Object
32 33 34 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/sum.rb', line 32 def aggs no_nested_aggregations('Sum') end |
#clone ⇒ self
Returns A copy of the receiver.
37 38 39 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/sum.rb', line 37 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.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/sum.rb', line 43 def to_h super do { sum: { field: field, missing: missing }.compact } end end |