Skip to content

Commit

Permalink
do not use es from setup (#67277)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov authored May 26, 2020
1 parent b10bd03 commit 85bdd94
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 32 deletions.

This file was deleted.

7 changes: 0 additions & 7 deletions x-pack/plugins/file_upload/server/kibana_server_services.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

let dataClient;

export const setElasticsearchClientServices = (elasticsearch) => {
({ dataClient } = elasticsearch);
};
export const getDataClient = () => dataClient;

let internalRepository;
export const setInternalRepository = (createInternalRepository) => {
internalRepository = createInternalRepository();
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/file_upload/server/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { initRoutes } from './routes/file_upload';
import { setElasticsearchClientServices, setInternalRepository } from './kibana_server_services';
import { setInternalRepository } from './kibana_server_services';
import { registerFileUploadUsageCollector, fileUploadTelemetryMappingsType } from './telemetry';

export class FileUploadPlugin {
Expand All @@ -15,7 +15,6 @@ export class FileUploadPlugin {

setup(core, plugins) {
core.savedObjects.registerType(fileUploadTelemetryMappingsType);
setElasticsearchClientServices(core.elasticsearch);
this.router = core.http.createRouter();
registerFileUploadUsageCollector(plugins.usageCollection);
}
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/file_upload/server/routes/file_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { callWithRequestFactory } from '../client/call_with_request_factory';
import { importDataProvider } from '../models/import_data';
import { updateTelemetry } from '../telemetry/telemetry';
import { MAX_BYTES } from '../../common/constants/file_import';
Expand Down Expand Up @@ -86,7 +85,7 @@ const finishValidationAndProcessReq = () => {
let resp;
try {
const validIdReqData = idConditionalValidation(body, boolHasId);
const callWithRequest = callWithRequestFactory(req);
const callWithRequest = con.core.elasticsearch.dataClient.callAsCurrentUser;
const { importData: importDataFunc } = importDataProvider(callWithRequest);

const { index, settings, mappings, ingestPipeline, data } = validIdReqData;
Expand Down

0 comments on commit 85bdd94

Please sign in to comment.