Class: Elasticsearch::DSL::Search::Filters::Nested
- Inherits:
-
Object
- Object
- Elasticsearch::DSL::Search::Filters::Nested
- Includes:
- BaseComponent
- Defined in:
- lib/elasticsearch/dsl/search/filters/nested.rb
Overview
A filter which executes another filter in the context of a nested document
Instance Method Summary collapse
-
#filter(*args, &block) ⇒ self
DSL method for building the ‘filter` part of the query definition.
-
#to_hash ⇒ Hash
Converts the query definition to a Hash.
Methods included from BaseComponent
Instance Method Details
#filter(*args, &block) ⇒ self
DSL method for building the ‘filter` part of the query definition
36 37 38 39 |
# File 'lib/elasticsearch/dsl/search/filters/nested.rb', line 36 def filter(*args, &block) @filter = block ? Filter.new(*args, &block) : args.first self end |
#to_hash ⇒ Hash
Converts the query definition to a Hash
45 46 47 48 49 50 51 52 |
# File 'lib/elasticsearch/dsl/search/filters/nested.rb', line 45 def to_hash hash = super if @filter _filter = @filter.respond_to?(:to_hash) ? @filter.to_hash : @filter hash[self.name].update(filter: _filter) end hash end |