Class: JayAPI::Elasticsearch::QueryBuilder::Aggregations::Sources::Sources

Inherits:
Object
  • Object
show all
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

Instance Method Details

#cloneself

Returns A copy of the receiver (not a shallow clone, it clones all of the elements of the collection).

Returns:

  • (self)

    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:

See Also:



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_aArray<Hash>

Returns Array representation of the collection of sources of the composite aggregation.

Returns:

  • (Array<Hash>)

    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