So I am attempting to use a bool query that checks a user's id against other user's blacklist, as well as removing users that a user has blacklisted in the results.
Each query works fine on its own, but not together. I was under the impression from the elasticsearch documentation that inside a bool query I could chain them with commas.
If someone could tell me where I'm going wrong, it'd be much appreciated.
client.search({
index: 'firebase',
type: 'user',
size: 500,
body: {
"query": {
"filtered" : {
"query" : {
"bool" : {
"must_not" : {
"terms": { "id": user.blacklist},
"term": { "blacklist": user.id}
}
}
},
"filter": {
"and": query
}
}
}
}
}).then(function (resp) {
var hits = resp.hits.hits;
res.send(hits);
console.log(hits);
}, function (err) {
console.log(err);
res.sendStatus(500);
});