Class: ElasticsearchDslBuilder::DSL::Search::Aggregations::Nested

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

Instance Method Summary collapse

Methods inherited from Aggregation

#aggregation

Constructor Details

#initialize(path = nil) ⇒ Nested

Returns a new instance of Nested.



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

def initialize(path = nil)
  @type = :nested
  path(path)
  super()
end

Instance Method Details

#path(path) ⇒ Object

Raises:

  • (ArgumentError)


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

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

#to_hashObject



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

def to_hash
  @aggregation = { path: @path }
  super
end