Class: JayAPI::Elasticsearch::QueryBuilder::Aggregations::Sources::Sources
- Inherits:
-
Object
- Object
- JayAPI::Elasticsearch::QueryBuilder::Aggregations::Sources::Sources
- Defined in:
- lib/jay_api/elasticsearch/query_builder/aggregations/sources/sources.rb
Overview
Represents the collection of sources for a Composite aggregation in Elasticsearch
Instance Method Summary collapse
-
#clone ⇒ self
A copy of the receiver (not a shallow clone, it clones all of the elements of the collection).
-
#terms(name, **kw_args) ⇒ Object
Adds a
termssource to the collection. -
#to_a ⇒ Array<Hash>
Array representation of the collection of sources of the composite aggregation.
Instance Method Details
#clone ⇒ self
Returns A copy of the receiver (not a shallow clone, it clones all of the elements of the collection).
28 29 30 31 32 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/sources/sources.rb', line 28 def clone self.class.new.tap do |copy| copy.sources.concat(sources.map(&:clone)) end end |
#terms(name, **kw_args) ⇒ Object
Adds a terms source to the collection. For information about the parameters:
16 17 18 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/sources/sources.rb', line 16 def terms(name, **kw_args) sources.push(::JayAPI::Elasticsearch::QueryBuilder::Aggregations::Sources::Terms.new(name, **kw_args)) end |
#to_a ⇒ Array<Hash>
Returns Array representation of the collection of sources of the composite aggregation.
22 23 24 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/sources/sources.rb', line 22 def to_a sources.map(&:to_h) end |