Class: Arelastic::Queries::Bool
- Inherits:
-
Query
- Object
- Nodes::Node
- Query
- Arelastic::Queries::Bool
- Defined in:
- lib/arelastic/queries/bool.rb
Instance Attribute Summary collapse
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#must ⇒ Object
Returns the value of attribute must.
-
#must_not ⇒ Object
Returns the value of attribute must_not.
-
#options ⇒ Object
Returns the value of attribute options.
-
#should ⇒ Object
Returns the value of attribute should.
Instance Method Summary collapse
- #as_elastic ⇒ Object
-
#initialize(options) ⇒ Bool
constructor
A new instance of Bool.
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
Methods included from Arities::Polyadic
Methods included from Arities::Unary
Constructor Details
#initialize(options) ⇒ Bool
Returns a new instance of Bool.
5 6 7 8 9 10 11 |
# File 'lib/arelastic/queries/bool.rb', line 5 def initialize() @must = read_option! , 'must' @filter = read_option! , 'filter' @should = read_option! , 'should' @must_not = read_option! , 'must_not' @options = end |
Instance Attribute Details
#filter ⇒ Object
Returns the value of attribute filter.
4 5 6 |
# File 'lib/arelastic/queries/bool.rb', line 4 def filter @filter end |
#must ⇒ Object
Returns the value of attribute must.
4 5 6 |
# File 'lib/arelastic/queries/bool.rb', line 4 def must @must end |
#must_not ⇒ Object
Returns the value of attribute must_not.
4 5 6 |
# File 'lib/arelastic/queries/bool.rb', line 4 def must_not @must_not end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/arelastic/queries/bool.rb', line 4 def @options end |
#should ⇒ Object
Returns the value of attribute should.
4 5 6 |
# File 'lib/arelastic/queries/bool.rb', line 4 def should @should end |
Instance Method Details
#as_elastic ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/arelastic/queries/bool.rb', line 13 def as_elastic searches = {} { 'must' => must, 'filter' => filter, 'should' => should, 'must_not' => must_not }.each do |k, v| searches[k] = convert_to_elastic(v) if v end { 'bool' => searches.update() } end |