Class: Elasticsearch::DSL::Search::Filters::And

Inherits:
Object
  • Object
show all
Includes:
BaseComponent, BaseCompoundFilterComponent
Defined in:
lib/elasticsearch/dsl/search/filters/and.rb

Overview

Note:

Since ‘and` is a keyword in Ruby, use the `_and` method in DSL definitions

A compound filter which matches documents by an intersection of individual filters.

Examples:

Pass the filters as a Hash

search do
  query do
    filtered do
      filter do
        _and filters: [ {term: { color: 'red' }}, {term: { size:  'xxl' }} ]
      end
    end
  end
end

Define the filters with a block


search do
  query do
    filtered do
      filter do
        _and do
          term color: 'red'
          term size:  'xxl'
        end
      end
    end
  end
end

See Also:

Method Summary

Methods included from BaseCompoundFilterComponent

included, #initialize

Methods included from BaseComponent

included, #initialize