From a93c2acafb2655a263851b72aae1092e8ea11c21 Mon Sep 17 00:00:00 2001 From: SuZhou-Joe Date: Wed, 9 Aug 2023 16:46:20 +0800 Subject: [PATCH] feat: optimize query DSL Signed-off-by: SuZhou-Joe --- src/core/public/workspace/workspaces_client.ts | 2 ++ .../workspace_saved_objects_client_wrapper.ts | 16 ++++------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/core/public/workspace/workspaces_client.ts b/src/core/public/workspace/workspaces_client.ts index 46ca139d9551..d203d947abe5 100644 --- a/src/core/public/workspace/workspaces_client.ts +++ b/src/core/public/workspace/workspaces_client.ts @@ -70,6 +70,8 @@ export class WorkspacesClient { } } ); + + this.init(); } /** diff --git a/src/core/server/workspaces/saved_objects/workspace_saved_objects_client_wrapper.ts b/src/core/server/workspaces/saved_objects/workspace_saved_objects_client_wrapper.ts index 6f156c199231..5f852d48a068 100644 --- a/src/core/server/workspaces/saved_objects/workspace_saved_objects_client_wrapper.ts +++ b/src/core/server/workspaces/saved_objects/workspace_saved_objects_client_wrapper.ts @@ -240,22 +240,14 @@ export class WorkspaceSavedObjectsClientWrapper { bool: { should: [ { - bool: { - must: { - term: { - type: 'config', - }, - }, + term: { + type: 'config', }, }, queryDSL.query, { - bool: { - should: permittedWorkspaceIds?.map((item) => ({ - terms: { - workspaces: [item], - }, - })), + terms: { + workspaces: permittedWorkspaceIds, }, }, ],