Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ describe('reindexService', () => {
allow_restricted_indices: true,
privileges: ['all'],
},
{
names: ['.tasks'],
privileges: ['read'],
},
],
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,6 @@ export const reindexServiceFactory = (
allow_restricted_indices: true,
privileges: ['all'],
},
{
names: ['.tasks'],
privileges: ['read'],
},
],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import type {
import type { ReindexSavedObject } from './types';

export interface ReindexServiceScopedClientArgs {
savedObjects: SavedObjectsClientContract;
dataClient: IScopedClusterClient;
request: KibanaRequest;
}
Expand Down Expand Up @@ -74,6 +73,7 @@ export class ReindexServiceWrapper {
logger: Logger;
licensing: LicensingPluginStart;
security: SecurityPluginStart;
soClient: SavedObjectsClientContract;
version: Version;
};

Expand All @@ -91,6 +91,7 @@ export class ReindexServiceWrapper {
logger,
licensing,
security,
soClient,
version,
};

Expand All @@ -116,10 +117,13 @@ export class ReindexServiceWrapper {
public getScopedClient({
dataClient,
request,
savedObjects,
}: ReindexServiceScopedClientArgs): ReindexServiceScopedClient {
const callAsCurrentUser = dataClient.asCurrentUser;
const reindexActions = reindexActionsFactory(savedObjects, callAsCurrentUser, this.deps.logger);
const reindexActions = reindexActionsFactory(
this.deps.soClient,
callAsCurrentUser,
this.deps.logger
);
const reindexService = reindexServiceFactory(
callAsCurrentUser,
reindexActions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import { schema } from '@kbn/config-schema';
import { errors } from '@elastic/elasticsearch';
import { handleEsError } from '@kbn/es-ui-shared-plugin/server';
import { REINDEX_OP_TYPE } from '@kbn/upgrade-assistant-pkg-server';
import { REINDEX_SERVICE_BASE_PATH } from '../../../common';
import type { RouteDependencies } from '../../types';
import { mapAnyErrorToKibanaHttpResponse } from './map_any_error_to_kibana_http_response';
Expand All @@ -33,13 +32,10 @@ export function registerBatchReindexIndicesRoutes({
async ({ core }, request, response) => {
const {
elasticsearch: { client: esClient },
savedObjects,
} = await core;
const { getClient } = savedObjects;

try {
const reindexService = (await getReindexService()).getScopedClient({
savedObjects: getClient({ includedHiddenTypes: [REINDEX_OP_TYPE] }),
dataClient: esClient,
request,
});
Expand Down Expand Up @@ -74,13 +70,11 @@ export function registerBatchReindexIndicesRoutes({
},
async ({ core }, request, response) => {
const {
savedObjects: { getClient },
elasticsearch: { client: esClient },
} = await core;
const { indices } = request.body;

const reindexService = (await getReindexService()).getScopedClient({
savedObjects: getClient({ includedHiddenTypes: [REINDEX_OP_TYPE] }),
dataClient: esClient,
request,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import { schema } from '@kbn/config-schema';
import { errors } from '@elastic/elasticsearch';
import { handleEsError } from '@kbn/es-ui-shared-plugin/server';
import { REINDEX_OP_TYPE } from '@kbn/upgrade-assistant-pkg-server';
import { REINDEX_SERVICE_BASE_PATH } from '../../../common';
import type { RouteDependencies } from '../../types';
import { mapAnyErrorToKibanaHttpResponse } from './map_any_error_to_kibana_http_response';
Expand Down Expand Up @@ -53,7 +52,6 @@ export function registerReindexIndicesRoutes({ router, getReindexService }: Rout
},
async ({ core }, request, response) => {
const {
savedObjects: { getClient },
elasticsearch: { client: esClient },
} = await core;

Expand All @@ -63,7 +61,6 @@ export function registerReindexIndicesRoutes({ router, getReindexService }: Rout

try {
const reindexService = (await getReindexService()).getScopedClient({
savedObjects: getClient({ includedHiddenTypes: [REINDEX_OP_TYPE] }),
dataClient: esClient,
request,
});
Expand Down Expand Up @@ -103,15 +100,12 @@ export function registerReindexIndicesRoutes({ router, getReindexService }: Rout
},
async ({ core }, request, response) => {
const {
savedObjects,
elasticsearch: { client: esClient },
} = await core;
const { getClient } = savedObjects;
const { indexName } = request.params;

try {
const reindexService = (await getReindexService()).getScopedClient({
savedObjects: getClient({ includedHiddenTypes: [REINDEX_OP_TYPE] }),
dataClient: esClient,
request,
});
Expand Down Expand Up @@ -147,15 +141,12 @@ export function registerReindexIndicesRoutes({ router, getReindexService }: Rout
},
async ({ core }, request, response) => {
const {
savedObjects,
elasticsearch: { client: esClient },
} = await core;
const { indexName } = request.params;
const { getClient } = savedObjects;

try {
const reindexService = (await getReindexService()).getScopedClient({
savedObjects: getClient({ includedHiddenTypes: [REINDEX_OP_TYPE] }),
dataClient: esClient,
request,
});
Expand Down