Class: ElasticsearchDslBuilder::DSL::Search::Queries::Exists
- Defined in:
- lib/elasticsearch_dsl_builder/dsl/search/queries/exists.rb
Instance Attribute Summary
Attributes inherited from Query
Instance Method Summary collapse
- #field(field) ⇒ Object
-
#initialize(field) ⇒ Exists
constructor
A new instance of Exists.
- #to_hash ⇒ Object
Constructor Details
#initialize(field) ⇒ Exists
Returns a new instance of Exists.
6 7 8 9 10 |
# File 'lib/elasticsearch_dsl_builder/dsl/search/queries/exists.rb', line 6 def initialize(field) @type = :exists field(field) super() end |
Instance Method Details
#field(field) ⇒ Object
12 13 14 15 16 |
# File 'lib/elasticsearch_dsl_builder/dsl/search/queries/exists.rb', line 12 def field(field) raise ArgumentError, 'field must be a String' unless field.instance_of?(String) @field = field self end |
#to_hash ⇒ Object
18 19 20 21 |
# File 'lib/elasticsearch_dsl_builder/dsl/search/queries/exists.rb', line 18 def to_hash @query = { field: @field } super end |