Class: Elasticsearch::DSL::Search::Filters::Query
- Inherits:
-
Object
- Object
- Elasticsearch::DSL::Search::Filters::Query
- Includes:
- BaseComponent
- Defined in:
- lib/elasticsearch/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.
46 47 48 49 50 51 52 |
# File 'lib/elasticsearch/dsl/search/filters/query.rb', line 46 def initialize(*args, &block) super if block @query = Elasticsearch::DSL::Search::Query.new(*args, &block) @block = nil end end |
Instance Method Details
#to_hash ⇒ Hash
Converts the query definition to a Hash
58 59 60 61 62 63 64 65 |
# File 'lib/elasticsearch/dsl/search/filters/query.rb', line 58 def to_hash hash = super if @query _query = @query.respond_to?(:to_hash) ? @query.to_hash : @query hash[self.name].update(_query) end hash end |