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 @@ -136,10 +136,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 @@ -522,10 +522,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 @@ -26,6 +26,7 @@ export function registerBatchReindexIndicesRoutes(
licensing,
log,
getSecurityPlugin,
getSavedObjectsService,
lib: { handleEsError },
}: RouteDependencies,
getWorker: () => ReindexWorker
Expand All @@ -47,15 +48,13 @@ export function registerBatchReindexIndicesRoutes(
versionCheckHandlerWrapper(async ({ core }, request, response) => {
const {
elasticsearch: { client: esClient },
savedObjects,
} = await core;
const { getClient } = savedObjects;

const soClient = getSavedObjectsService().getUnsafeInternalClient({
includedHiddenTypes: [REINDEX_OP_TYPE],
});
const callAsCurrentUser = esClient.asCurrentUser;
const reindexActions = reindexActionsFactory(
getClient({ includedHiddenTypes: [REINDEX_OP_TYPE] }),
callAsCurrentUser,
log
);
const reindexActions = reindexActionsFactory(soClient, callAsCurrentUser, log);
try {
const inProgressOps = await reindexActions.findAllByStatus(ReindexStatus.inProgress);
const { queue } = sortAndOrderReindexOperations(inProgressOps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function registerReindexIndicesRoutes(
licensing,
log,
getSecurityPlugin,
getSavedObjectsService,
lib: { handleEsError },
}: RouteDependencies,
getWorker: () => ReindexWorker
Expand All @@ -48,13 +49,15 @@ export function registerReindexIndicesRoutes(
},
versionCheckHandlerWrapper(async ({ core }, request, response) => {
const {
savedObjects: { getClient },
elasticsearch: { client: esClient },
} = await core;
const { indexName } = request.params;
const soClient = getSavedObjectsService().getUnsafeInternalClient({
includedHiddenTypes: [REINDEX_OP_TYPE],
});
try {
const result = await reindexHandler({
savedObjects: getClient({ includedHiddenTypes: [REINDEX_OP_TYPE] }),
savedObjects: soClient,
dataClient: esClient,
indexName,
log,
Expand Down Expand Up @@ -97,17 +100,14 @@ export function registerReindexIndicesRoutes(
},
versionCheckHandlerWrapper(async ({ core }, request, response) => {
const {
savedObjects,
elasticsearch: { client: esClient },
} = await core;
const { getClient } = savedObjects;
const { indexName } = request.params;
const asCurrentUser = esClient.asCurrentUser;
const reindexActions = reindexActionsFactory(
getClient({ includedHiddenTypes: [REINDEX_OP_TYPE] }),
asCurrentUser,
log
);
const soClient = getSavedObjectsService().getUnsafeInternalClient({
includedHiddenTypes: [REINDEX_OP_TYPE],
});
const reindexActions = reindexActionsFactory(soClient, asCurrentUser, log);
const reindexService = reindexServiceFactory(asCurrentUser, reindexActions, log, licensing);

try {
Expand Down