Method: Elasticsearch::DSL::Search::Filters::Bool#must

Defined in:
lib/elasticsearch/dsl/search/filters/bool.rb

#must(*args, &block) ⇒ Object



62
63
64
65
66
67
# File 'lib/elasticsearch/dsl/search/filters/bool.rb', line 62

def must(*args, &block)
  @hash[name][:must] ||= []
  value = args.empty? ? Filter.new(*args, &block).to_hash : args.first.to_hash
  @hash[name][:must].push(value).flatten! unless @hash[name][:must].include?(value)
  self
end