From c50c4181af7afed857474d42a4c2f3382466ade5 Mon Sep 17 00:00:00 2001 From: SuZhou-Joe Date: Wed, 17 Apr 2024 16:14:36 +0800 Subject: [PATCH] temp: save Signed-off-by: SuZhou-Joe --- .../service/lib/search_dsl/query_params.ts | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/core/server/saved_objects/service/lib/search_dsl/query_params.ts b/src/core/server/saved_objects/service/lib/search_dsl/query_params.ts index 1016a8dfefa4..d2722001c777 100644 --- a/src/core/server/saved_objects/service/lib/search_dsl/query_params.ts +++ b/src/core/server/saved_objects/service/lib/search_dsl/query_params.ts @@ -309,6 +309,19 @@ export function getQueryParams({ }, }); } + } else { + // If not workspaces passed, find all the objects without workspaces field + bool.filter.push({ + bool: { + must_not: [ + { + exists: { + field: 'workspaces', + }, + }, + ], + }, + }); } if (ACLSearchParamsShouldClause.length) { @@ -316,16 +329,11 @@ export function getQueryParams({ bool: { should: [ /** - * Return those objects without workspaces field and permissions field to keep find API backward compatible + * Return those objects without permissions field to keep find API backward compatible */ { bool: { must_not: [ - { - exists: { - field: 'workspaces', - }, - }, { exists: { field: 'permissions',