Class: Arelastic::Queries::Filter

Inherits:
Query show all
Defined in:
lib/arelastic/queries/filter.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, #hash, #read_option!

Methods included from Arities::Binary

#binary

Methods included from Arities::Polyadic

#polyadic

Methods included from Arities::Unary

#unary

Constructor Details

#initialize(query, options = {}) ⇒ Filter

Returns a new instance of Filter.



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

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

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

#queryObject

Returns the value of attribute query.



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

def query
  @query
end

Instance Method Details

#as_elasticObject



10
11
12
13
14
# File 'lib/arelastic/queries/filter.rb', line 10

def as_elastic
  {
    'filter' => convert_to_elastic(query)
  }.update(options)
end