1. bool查询
must | 必须批配,贡献算分 |
should | 选择批配,贡献算分 |
must_not | Filter Context 查询子句,必须不能匹配 |
filter | Filter Context 必须批配,但不贡献算分 |
POST /products/_search
{
"query": {
"bool": {
"must": {
"term": {"price": "30"}
},
"filter": {
"term": { "avaliable": "true" }
},
"must_not":{
"range":{
"price":{"le":10}
},
"should":[
{"term":{"productID.keyword":"JODL-1"}},
{"term":{"productID.keyword":"JODL-2"}}
],
"minimum_should_match":1
}
}
}
2. boosting 查询
POST /products/_search
{
"query": {
"boosting": {
"positive": {
"match": {
"comment": "comment"
}
},
"negative": {
"match": {
"comment": "abc"
}
},
"negative_boost": 0.5
}
}
}