Class: Arelastic::Queries::Exists

Inherits:
Query show all
Defined in:
lib/arelastic/queries/exists.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(field, options = {}) ⇒ Exists

Options:

"null_value" => "_null_"


8
9
10
11
# File 'lib/arelastic/queries/exists.rb', line 8

def initialize field, options = {}
  @field = field
  @options = options
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



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

def field
  @field
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#as_elasticObject



13
14
15
16
# File 'lib/arelastic/queries/exists.rb', line 13

def as_elastic
  params = {"field" => field}.update(options)
  {"exists" => params}
end