Class: Arelastic::Queries::HasChild

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Query

#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(type, query) ⇒ HasChild

Returns a new instance of HasChild.



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

def initialize type, query
  @type = type
  @query = query
end

Instance Attribute Details

#queryObject (readonly)

Returns the value of attribute query.



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

def query
  @query
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#as_elasticObject



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

def as_elastic
  {
    "has_child" => {
      "type"  => type,
      "query" => convert_to_elastic(query)
    }
  }
end