If I run this query below:
GET test/_search
{
"size": 4,
"query": {
"match":{
"court_name":
{
"query": "Texas",
"analyzer": "standard",
"minimum_should_match": "2<10% 3<30% 4<20%"
}
}
}
}
I'm able to find the document. But when I add an irrelevant word like "Texas banana" it finds no results! It should still find the document that was found earlier. What's happening?
the parameter minimum_should_match
in the match
clause define the number of words that the match
query should match in your example you specify 2<10%
which means if the match query contains 2 words or less it must match the two words in order to return a results if the query contains more than 2 words it should match 10% of the given words in your case if you try "Texas banana apple" instead of "Texas banana" you will match the document that you re looking for