Class: Arelastic::Queries::GeoBoundingBox

Inherits:
Query show all
Defined in:
lib/arelastic/queries/geo_bounding_box.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, bounds, options = {}) ⇒ GeoBoundingBox

Returns a new instance of GeoBoundingBox.



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

def initialize(field, bounds, options = {})
  @field    = field
  @bounds   = bounds
  @options  = options
end

Instance Attribute Details

#boundsObject

Returns the value of attribute bounds.



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

def bounds
  @bounds
end

#fieldObject

Returns the value of attribute field.



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

def field
  @field
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#as_elasticObject



11
12
13
14
15
# File 'lib/arelastic/queries/geo_bounding_box.rb', line 11

def as_elastic
  params = {field => bounds}.update(options)

  { "geo_bounding_box" => params }
end