From d5881f85a10bf26144b99d8bee9d188bbe403d9b Mon Sep 17 00:00:00 2001 From: Luca Graglia Date: Fri, 5 Sep 2025 09:29:00 -0500 Subject: [PATCH] extend include / exclude filter options --- src/server/es/filter.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/server/es/filter.js b/src/server/es/filter.js index 8c4fc6b60..3058f32c1 100644 --- a/src/server/es/filter.js +++ b/src/server/es/filter.js @@ -85,6 +85,7 @@ const getFilterItemForString = (op, pField, value, path) => { [field]: value, }, }; + case 'CONTAINS_ANY': case 'in': case 'IN': // if using missingDataAlias, we need to remove the missingDataAlias from filter values @@ -121,13 +122,32 @@ const getFilterItemForString = (op, pField, value, path) => { [field]: value, }, }; + case 'CONTAINS_ALL': + return { + bool: { + must: value.map((v) => ({ + term: { [field]: v }, + })), + }, + }; case '!=': + case 'EXCLUDES_ANY': + return { + bool: { + must_not: value.map((v) => ({ + term: { [field]: v }, + })), + }, + }; + case 'EXCLUDES_ALL': return { bool: { must_not: [ { - term: { - [field]: value, + bool: { + must: value.map((v) => ({ + term: { [field]: v }, + })), }, }, ],