You can use the minimum_should_match
parameter to specify the number or percentage of should
clauses returned documents must match.
If the bool
query includes at least one should
clause and no must
or filter
clauses, the default value is 1
. Otherwise, the default value is 0
.
For other valid values, see the minimum_should_match
parameter.
POST _search { "query": { "bool" : { "must" : { "term" : { "user.id" : "kimchy" } }, "filter": { "term" : { "tags" : "production" } }, "must_not" : { "range" : { "age" : { "gte" : 10, "lte" : 20 } } }, "should" : [ { "term" : { "tags" : "env1" } }, { "term" : { "tags" : "deployed" } } ], "minimum_should_match" : 1, "boost" : 1.0 } } }
沒有留言:
張貼留言