Class: ElasticQuery::NestedQuery

Inherits:
Query show all
Defined in:
lib/elastic_query/nested_query.rb

Instance Attribute Summary collapse

Attributes inherited from Query

#query

Instance Method Summary collapse

Constructor Details

#initialize(object, query, options = {}) ⇒ NestedQuery

Returns a new instance of NestedQuery.



5
6
7
8
9
# File 'lib/elastic_query/nested_query.rb', line 5

def initialize(object, query, options = {})
  @object = object
  @options = options
  super(query)
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



3
4
5
# File 'lib/elastic_query/nested_query.rb', line 3

def object
  @object
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/elastic_query/nested_query.rb', line 3

def options
  @options
end

Instance Method Details

#to_hashObject



11
12
13
14
15
16
17
18
# File 'lib/elastic_query/nested_query.rb', line 11

def to_hash
  {
    nested: {
      path: object.to_s,
      filter: query.to_hash,
    }.merge(options)
  }
end