Class: Arelastic::Queries::HasParent

Inherits:
Query show all
Defined in:
lib/arelastic/queries/has_parent.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Query

#has_child, #has_parent, #negate, #nested

Methods inherited from Nodes::Node

#==, #convert_to_elastic, #read_option!

Methods included from Arities::Binary

#binary

Methods included from Arities::Polyadic

#polyadic

Methods included from Arities::Unary

#unary

Constructor Details

#initialize(parent_type, query) ⇒ HasParent

Returns a new instance of HasParent.



6
7
8
9
# File 'lib/arelastic/queries/has_parent.rb', line 6

def initialize parent_type, query
  @parent_type = parent_type
  @query = query
end

Instance Attribute Details

#parent_typeObject (readonly)

Returns the value of attribute parent_type.



4
5
6
# File 'lib/arelastic/queries/has_parent.rb', line 4

def parent_type
  @parent_type
end

#queryObject (readonly)

Returns the value of attribute query.



4
5
6
# File 'lib/arelastic/queries/has_parent.rb', line 4

def query
  @query
end

Instance Method Details

#as_elasticObject



11
12
13
14
15
16
17
18
# File 'lib/arelastic/queries/has_parent.rb', line 11

def as_elastic
  {
    "has_parent" => {
      "parent_type" => parent_type,
      "query"       => convert_to_elastic(query)
    }
  }
end