Class: OpenSearch::DSL::Search::Filters::Or

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

Overview

Note:

Since ‘or` is a keyword in Ruby, use the `_or` method in DSL definitions

A compound filter which matches documents by a union of individual filters.

Examples:

Pass the filters as a Hash

search do
  query do
    filtered do
      filter do
        _or 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
        _or 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