Class: Elasticquery::Filters::Search
- Defined in:
- lib/elasticquery/filters/search.rb
Constant Summary collapse
- OPERATORS =
%w(and or)
- TYPES =
%w(best_fields most_fields cross_fields phrase pharse_prefix)
Instance Method Summary collapse
-
#initialize(query, fields: "_all", operator: "and", type: "best_fields") ⇒ Search
constructor
Create new search subquery.
-
#to_hash ⇒ Hash
Hash presentation of query.
-
#valid? ⇒ Boolean
Is current query valid to exec.
Methods inherited from Base
Constructor Details
#initialize(query, fields: "_all", operator: "and", type: "best_fields") ⇒ Search
Create new search subquery
15 16 17 18 19 20 |
# File 'lib/elasticquery/filters/search.rb', line 15 def initialize(query, fields: "_all", operator: "and", type: "best_fields") @fields = fields @operator = operator @type = type @query = query end |
Instance Method Details
#to_hash ⇒ Hash
Hash presentation of query.
42 43 44 |
# File 'lib/elasticquery/filters/search.rb', line 42 def to_hash valid? ? {query: {filtered: {query: {multi_match: subquery}}}} : {} end |