你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
Jea - 一只猿
赞同来自:
差不多就这样, 循环嵌套bool,去吧; 有需求的话加上minimum_should_match控制should
"bool": { "must": [ { "bool": { "must": [ { "term": { "a": "a", "b:"b } } ] } }, { "bool": { "should": { "term": { "c": c,"d":d } } ] } } ] }
{ "query": { "bool": { "filter": { "bool": { "must": [ { "bool": { "must": [ { "term": { "house_id": "594243b87f8b9a3a08d2b1a5" } } ] } }, { "bool": { "must_not": [ { "term": { "system": true } } ] } }, { "bool": { "must_not": [ { "term": { "types": 1015 } } ] } } ], "should": [ { "bool": { "should": { "bool": { "should": [ { "bool": { "must_not": [ { "term": { "id": 1 } } ] } }, { "bool": { "must_not": [ { "term": { "types": 1009 } }, { "term": { "types": 1010 } }, { "term": { "types": 1016 } }, { "term": { "types": 1017 } }, { "term": { "types": 1012 } } ] } } ] } } } }, { "bool": { "should": { "bool": { "should": [ { "bool": { "must": [ { "term": { "admin_id": "55f238add6e4688e648b45d8" } } ] } }, { "bool": { "must": [ { "terms": { "types": [ 1009, 1010, 1016, 1017, 1012 ] } } ] } } ] } } } } ] } } } } }
bellengao - 博客: https://www.jianshu.com/u/e0088e3e2127
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
要回复问题请先登录或注册
90后it
3 个回复
Jea - 一只猿
赞同来自:
下面的json是我单元测试写循环嵌套 or and 条件用的, 你参考下
bellengao - 博客: https://www.jianshu.com/u/e0088e3e2127
赞同来自:
"query": {
"bool": {
"must": [
{
"term": {
"a": "1"
}
},
{
"term": {
"b": "2"
}
},
{
"bool": {
"should": [
{
"bool": {
"must": [
{
"term": {
"c": "3"
}
},
{
"term": {
"d": "4"
}
}
]
}
},
{
"term": {
"e": "5"
}
}
]
}
}
]
}
}
}
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自: