Skip to content
Snippets Groups Projects
Commit 643fb681 authored by Felipe Wu's avatar Felipe Wu
Browse files

add must not


Signed-off-by: default avatarFelipe Wu <felipeshiwu@gmail.com>
parent 783b05d8
No related branches found
No related tags found
No related merge requests found
Pipeline #20203 failed
......@@ -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++) {
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 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment