diff --git a/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/utils/find_shared_origin_objects.ts b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/utils/find_shared_origin_objects.ts index 8db6f775f66bd..e2408570307a9 100644 --- a/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/utils/find_shared_origin_objects.ts +++ b/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/utils/find_shared_origin_objects.ts @@ -116,14 +116,13 @@ function createOriginKueryFilter( // If we are updating an object's spaces (as opposed to copying)... if (purpose === 'updateObjectsSpaces') { - // we never want to match if the raw document `_id` fields. + // we never want to match on the raw document `_id` fields. // If they are equal, this just means that the object already exists in that space and it's ok. - const idMatch = buildNode( + const notIdMatch = buildNode(KQL_FUNCTION_NOT, buildNode( KQL_FUNCTION_IS, `${type}.id`, esKuery.escapeKuery(`${type}:${id}`) - ); - const notIdMatch = buildNode(KQL_FUNCTION_NOT, idMatch); + )); // If this object has an origin ID, then we do still want to match if another object's ID matches the // object's origin (idMatchesOrigin), or if another object's origin matches the object's origin (originMatch).