| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 | [[query-dsl-minimum-should-match]]== Minimum Should MatchThe `minimum_should_match` parameter possible values:[cols="<,<,<",options="header",]|=======================================================================|Type |Example |Description|Integer |`3` |Indicates a fixed value regardless of the number ofoptional clauses.|Negative integer |`-2` |Indicates that the total number of optionalclauses, minus this number should be mandatory.|Percentage |`75%` |Indicates that this percent of the total number ofoptional clauses are necessary. The number computed from the percentageis rounded down and used as the minimum.|Negative percentage |`-25%` |Indicates that this percent of the totalnumber of optional clauses can be missing. The number computed from thepercentage is rounded down, before being subtracted from the total todetermine the minimum.|Combination |`3<90%` |A positive integer, followed by the less-thansymbol, followed by any of the previously mentioned specifiers is aconditional specification. It indicates that if the number of optionalclauses is equal to (or less than) the integer, they are all required,but if it's greater than the integer, the specification applies. In thisexample: if there are 1 to 3 clauses they are all required, but for 4 ormore clauses only 90% are required.|Multiple combinations |`2<-25% 9<-3` |Multiple conditionalspecifications can be separated by spaces, each one only being valid fornumbers greater than the one before it. In this example: if there are 1or 2 clauses both are required, if there are 3-9 clauses all but 25% arerequired, and if there are more than 9 clauses, all but three arerequired.|=======================================================================*NOTE:*When dealing with percentages, negative values can be used to getdifferent behavior in edge cases. 75% and -25% mean the same thing whendealing with 4 clauses, but when dealing with 5 clauses 75% means 3 arerequired, but -25% means 4 are required.If the calculations based on the specification determine that nooptional clauses are needed, the usual rules about BooleanQueries stillapply at search time (a BooleanQuery containing no required clauses muststill match at least one optional clause)No matter what number the calculation arrives at, a value greater thanthe number of optional clauses, or a value less than 1 will never beused. (ie: no matter how low or how high the result of the calculationresult is, the minimum number of required matches will never be lowerthan 1 or greater than the number of clauses.
 |