karmi/tire — Issue #200: Searching for a string with boolean / filter
Author: ramontayag
Created: 2012-01-12 08:13:15+00:00
State: open

Hi @karmi, thanks to your comment in [this issue](https://github.com/karmi/tire/issues/102), I was able to get a set records based on a boolean.

Now, I'd like to combine the two. I'd like to search within the set of artists that have the `has_music => true`. I tried many ways of building this query, some of which are below:

[Term](http://www.elasticsearch.org/guide/reference/query-dsl/term-query.html)

artist_search = Artist.search do
query do
string @query
end
filter :term, :has_music => true
end

The rest had parse errors:

artist_search = Artist.search do
query do
string @query
boolean do
must { string :has_music => true }
end
end
end

artist_search = Artist.search do |search|
search.query do |query|
query.string @query
query.boolean do |boolean|
boolean.must { string :has_music => true }
end
end
end

How do you combine the two?

Thanks