文章40 | 阅读 24041 | 点赞0
bool过滤查询
可以实现组合过滤查询
格式:
{ "bool": { "must: 0, "should: O, "must not":0}}
must:必须满足的条件---and
should:可以满足也可以不满足的条件--or
must_ not:不需要满足的条件--not
GET /lib5/items/_search
{
"post_filter": {
"bool": {
"should": [
{"term": {"price":25}},
{"term": {"itemID": "id100123"}}
],
"must_not": {
"term":{"price": 30}
}
}
}
}
GET /lib5/items/_search
{
"query": {
"bool": {
"should": [
{"term": {"price":25}},
{"term": {"itemID": "id100123"}}
],
"must_not": {
"term":{"price": 30}
}
}
}
}
范围查询
GET /lib5/items/_search
{
"query": {
"bool": {
"filter": {
"range": {
"price": {
"gt": 25,
"lt": 50
}
}
}
}
}
}
是否存在
GET /lib5/items/_search
{
"query": {
"bool": {
"filter": {
"exists":{ "field":"price"}
}
}
}
}
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/ywl470812087/article/details/105081162
内容来源于网络,如有侵权,请联系作者删除!