多个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"
}
}]
}
{
"_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"
}
}]
}
1 个回复
zpeng
赞同来自: