Class: Elasticquery::Filters::Exists
- Defined in:
- lib/elasticquery/filters/exists.rb
Instance Method Summary collapse
-
#initialize(field = nil) ⇒ Exists
constructor
A new instance of Exists.
- #to_hash ⇒ Object
- #to_not_hash ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(field = nil) ⇒ Exists
Returns a new instance of Exists.
7 8 9 |
# File 'lib/elasticquery/filters/exists.rb', line 7 def initialize(field = nil) @field = field end |
Instance Method Details
#to_hash ⇒ Object
15 16 17 |
# File 'lib/elasticquery/filters/exists.rb', line 15 def to_hash {exists: {field: @field}} end |
#to_not_hash ⇒ Object
19 20 21 |
# File 'lib/elasticquery/filters/exists.rb', line 19 def to_not_hash {missing: {field: @field}} end |
#valid? ⇒ Boolean
11 12 13 |
# File 'lib/elasticquery/filters/exists.rb', line 11 def valid? @field.present? end |