Minimum_match


(Kellan) #1

I'm attempting to use the terms query syntax suggested in
http://www.elasticsearch.org/guide/reference/query-dsl/terms-query.html
i.e. { "terms" : { "tags" : [ "blue", "red" ], "minimum_match" :
2 } }. In this case I would like my results to match both "blue" and
"red", but I'm getting all results that match one or the other. Is
this the proper way to write the query? I thought {"and" :
[ { "term" : { "tags" : "blue"} }, {"term": {"tags": "red"} }]} may be
slower since the search didn't necessarily know the term queries were
looking at the same field. Thoughts?

Kellan


(Shay Banon) #2

Yes, it should work, want to gist a sample showing it doen't?

On Thu, Dec 29, 2011 at 11:11 PM, Kellan wampleek@gmail.com wrote:

I'm attempting to use the terms query syntax suggested in
http://www.elasticsearch.org/guide/reference/query-dsl/terms-query.html
i.e. { "terms" : { "tags" : [ "blue", "red" ], "minimum_match" :
2 } }. In this case I would like my results to match both "blue" and
"red", but I'm getting all results that match one or the other. Is
this the proper way to write the query? I thought {"and" :
[ { "term" : { "tags" : "blue"} }, {"term": {"tags": "red"} }]} may be
slower since the search didn't necessarily know the term queries were
looking at the same field. Thoughts?

Kellan


(system) #3