Class: OpenSearch::DSL::Search::Filters::Query
- Inherits:
-
Object
- Object
- OpenSearch::DSL::Search::Filters::Query
- Includes:
- BaseComponent
- Defined in:
- lib/opensearch/dsl/search/filters/query.rb
Overview
A filter which wraps a query so it can be used as a filter
Instance Method Summary collapse
-
#initialize(*args, &block) ⇒ Query
constructor
A new instance of Query.
-
#to_hash ⇒ Hash
Converts the query definition to a Hash.
Methods included from BaseComponent
Constructor Details
#initialize(*args, &block) ⇒ Query
Returns a new instance of Query.
54 55 56 57 58 59 |
# File 'lib/opensearch/dsl/search/filters/query.rb', line 54 def initialize(*args, &block) super return unless block @query = OpenSearch::DSL::Search::Query.new(*args, &block) @block = nil end |
Instance Method Details
#to_hash ⇒ Hash
Converts the query definition to a Hash
65 66 67 68 69 70 71 72 |
# File 'lib/opensearch/dsl/search/filters/query.rb', line 65 def to_hash hash = super if @query _query = @query.respond_to?(:to_hash) ? @query.to_hash : @query hash[name].update(_query) end hash end |