Class: ElasticsearchDslBuilder::DSL::Search::Aggregations::Children

Inherits:
Aggregation
  • Object
show all
Defined in:
lib/elasticsearch_dsl_builder/dsl/search/aggregations/children.rb

Instance Method Summary collapse

Methods inherited from Aggregation

#aggregation

Constructor Details

#initialize(type) ⇒ Children

Returns a new instance of Children.



6
7
8
9
10
# File 'lib/elasticsearch_dsl_builder/dsl/search/aggregations/children.rb', line 6

def initialize(type)
  @type = :children
  type(type)
  super()
end

Instance Method Details

#to_hashObject



18
19
20
21
# File 'lib/elasticsearch_dsl_builder/dsl/search/aggregations/children.rb', line 18

def to_hash
  @aggregation = { type: @child_type }
  super
end

#type(type) ⇒ Object

Raises:

  • (ArgumentError)


12
13
14
15
16
# File 'lib/elasticsearch_dsl_builder/dsl/search/aggregations/children.rb', line 12

def type(type)
  raise ArgumentError, 'type must be a String' unless type.instance_of?(String)
  @child_type = type
  self
end