Class: ElasticsearchQuery::Filters

Inherits:
Object
  • Object
show all
Defined in:
lib/elasticsearch_query/filters.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Filters

Returns a new instance of Filters.



3
4
5
# File 'lib/elasticsearch_query/filters.rb', line 3

def initialize( params )
  @params = params
end

Instance Method Details

#to_hashObject



7
8
9
10
11
12
13
# File 'lib/elasticsearch_query/filters.rb', line 7

def to_hash
  if matches.length == 1
    matches.first
  else
    { bool: { must: matches } }
  end
end