Commit 643fb681 authored by Felipe Wu's avatar Felipe Wu

add must not

Signed-off-by: 's avatarFelipe Wu <felipeshiwu@gmail.com>
parent 783b05d8
Pipeline #20203 failed with stages
in 35 seconds
......@@ -54,13 +54,20 @@ export class ElasticsearchAdapter extends Adapter {
let filter = {};
let match = [];
let nMatch = [];
/** Query is used to define the filters */
if (view.clauses.length > 0) {
for(let i=0;i<view.clauses[0].filters.length; i++) {
filter = {"match": { [view.clauses[0].filters[i].target.name]: view.clauses[0].filters[i].value }};
match.push(filter);
if (view.clauses[0].filters[i].operator == 2) {
filter = {"match": { [view.clauses[0].filters[i].target.name]: view.clauses[0].filters[i].value }};
nMatch.push(filter);
} else {
filter = {"match": { [view.clauses[0].filters[i].target.name]: view.clauses[0].filters[i].value }};
match.push(filter);
}
}
Object.assign(query.query.bool, {must: match});
Object.assign(query.query.bool, {must_not: nMatch});
}
/** Aggregation is used to define the dimention and the aggregation */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment