Hello,World

多个json query dsl合并成一条语句

Elasticsearch | 作者 zpeng | 发布于2019年12月16日 | 阅读数:1683

多个json query dsl合并成一条语句,我用的Java API,想到是bool + wrap的方案,不过貌似行不通,合并的dsl执行报json_parse_exception。

{
"_source": {
"exclude": [],
"include": ["id"]
},
"from": 0,
"query": {
"bool": {
"must": [{
"wrapper": {
"query": "{\"term\":{\"status\":\"0\"}}"
}
}, {
"wrapper": {
"query": "{\"range\":{\"totalVote\":{\"gte\":100}}}"
}
}, {
"wrapper": {
"query": "{\"term\":{\"tenantId\":\"FORTUNE\"}}"
}
}, {
"wrapper": {
"query": "{\"terms\":{\"label_operation\":[\"o_topicCat_fund\"]}}"
}
}, {
"wrapper": {
"query": "{\"range\":{\"gmtCreate\":{\"gte\":1573875364422}}}"
}
}],
"must_not": [{
"wrapper": {
"query": "{\"term\":{\"isRecommend\":-1}}"
}
}]
}
},
"size": 10,
"sort": [{
"gmtCreate": {
"order": "desc"
}
}]
}

已邀请:

zpeng

赞同来自:

多条现有json dsl query,有现成的API或手段合并成一条么,满足任意dsl条件即可。

要回复问题请先登录注册