Class: Stretchy::Queries::MatchQuery
- Defined in:
- lib/stretchy/queries/match_query.rb
Constant Summary collapse
- OPERATORS =
['and', 'or']
Constants included from Utils::Contract
Utils::Contract::ASSERTIONS, Utils::Contract::DISTANCE_FORMAT
Instance Method Summary collapse
-
#initialize(string, field: '_all', operator: 'and') ⇒ MatchQuery
constructor
A new instance of MatchQuery.
- #to_search ⇒ Object
Methods included from Utils::Contract
Constructor Details
#initialize(string, field: '_all', operator: 'and') ⇒ MatchQuery
Returns a new instance of MatchQuery.
11 12 13 14 15 16 |
# File 'lib/stretchy/queries/match_query.rb', line 11 def initialize(string, field: '_all', operator: 'and') @field = field @operator = operator @string = string validate! end |
Instance Method Details
#to_search ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/stretchy/queries/match_query.rb', line 18 def to_search { match: { @field => { query: @string, operator: @operator } } } end |