From 1bc2c7d15a4bd5d0f46fd19c3c6ed2114fef19b4 Mon Sep 17 00:00:00 2001 From: Zoltan Szabo Date: Thu, 9 Feb 2023 12:20:57 +0200 Subject: [PATCH] if the range is empty, don't add it to the query --- searchlib/lib/search/query/filters.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/searchlib/lib/search/query/filters.js b/searchlib/lib/search/query/filters.js index 398d2746c..c7c4e524f 100644 --- a/searchlib/lib/search/query/filters.js +++ b/searchlib/lib/search/query/filters.js @@ -185,6 +185,10 @@ export function getDateRangeFilter(filter, filterConfig) { }, }; + if (res.bool[op][0].range[filter.field].to === undefined){ + return; + } + return res; }