Skip to content

Commit

Permalink
Drop support for deleting the Kibana index (#29268)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdavies authored Jan 24, 2019
1 parent c4aa278 commit 93d5b81
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 245 deletions.
13 changes: 0 additions & 13 deletions src/server/saved_objects/migrations/core/call_cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export interface CallCluster {
(path: 'indices.getMapping', opts: IndexOpts): Promise<MappingResult>;
(path: 'indices.getSettings', opts: IndexOpts): Promise<IndexSettingsResult>;
(path: 'indices.putMapping', opts: PutMappingOpts): Promise<any>;
(path: 'indices.putTemplate', opts: PutTemplateOpts): Promise<any>;
(path: 'indices.refresh', opts: IndexOpts): Promise<any>;
(path: 'indices.updateAliases', opts: UpdateAliasesOpts): Promise<any>;
(path: 'reindex', opts: ReindexOpts): Promise<any>;
Expand Down Expand Up @@ -67,18 +66,6 @@ export interface PutMappingOpts {
index: string;
}

export interface PutTemplateOpts {
name: string;
body: {
template: string;
settings: {
number_of_shards: number;
auto_expand_replicas: string;
};
mappings: IndexMapping;
};
}

export interface IndexOpts {
index: string;
}
Expand Down
40 changes: 0 additions & 40 deletions src/server/saved_objects/service/create_saved_objects_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,53 +31,13 @@ import { SavedObjectsClient } from './saved_objects_client';
// Eventually, we hope to build a first-class import / export API, at which point, we can
// remove the migrator from the saved objects client and leave only document validation here.
export function createSavedObjectsService(server, schema, serializer, migrator) {
const onBeforeWrite = async () => {
const adminCluster = server.plugins.elasticsearch.getCluster('admin');

try {
const index = server.config().get('kibana.index');
await adminCluster.callWithInternalUser('indices.putTemplate', {
name: `kibana_index_template:${index}`,
body: {
template: index,
settings: {
number_of_shards: 1,
auto_expand_replicas: '0-1',
},
mappings: server.getKibanaIndexMappingsDsl(),
},
});
} catch (error) {
server.logWithMetadata(
['debug', 'savedObjects'],
`Attempt to write indexTemplate for SavedObjects index failed: ${error.message}`,
{
es: {
resp: error.body,
status: error.status,
},
err: {
message: error.message,
stack: error.stack,
},
}
);

// We reject with `es.ServiceUnavailable` because writing an index
// template is a very simple operation so if we get an error here
// then something must be very broken
throw new adminCluster.errors.ServiceUnavailable();
}
};

const mappings = server.getKibanaIndexMappingsDsl();
const repositoryProvider = new SavedObjectsRepositoryProvider({
index: server.config().get('kibana.index'),
migrator,
mappings,
schema,
serializer,
onBeforeWrite,
});

const scopedClientProvider = new ScopedSavedObjectsClientProvider({
Expand Down
20 changes: 5 additions & 15 deletions src/ui/ui_settings/routes/__tests__/doc_exists.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,12 @@ export function docExistsSuite() {
const { kbnServer, uiSettings, callCluster } = getServices();

// delete the kibana index to ensure we start fresh
await callCluster('indices.delete', {
await callCluster('deleteByQuery', {
index: kbnServer.config.get('kibana.index'),
ignore: [404]
});

// write a setting to create kibana index and savedConfig
await kbnServer.inject({
method: 'POST',
url: '/api/kibana/settings/defaultIndex',
payload: { value: 'abc' }
});

// delete our defaultIndex setting to make doc empty
await kbnServer.inject({
method: 'DELETE',
url: '/api/kibana/settings/defaultIndex',
body: {
conflicts: 'proceed',
query: { match_all: {} }
},
});

if (initialSettings) {
Expand Down
2 changes: 0 additions & 2 deletions src/ui/ui_settings/routes/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
import { docExistsSuite } from './doc_exists';
import { docMissingSuite } from './doc_missing';
import { docMissingAndIndexReadOnlySuite } from './doc_missing_and_index_read_only';
import { indexMissingSuite } from './index_missing';

describe('uiSettings/routes', function () {
/**
Expand All @@ -48,7 +47,6 @@ describe('uiSettings/routes', function () {
this.timeout(10000);

before(startServers);
describe('index missing', indexMissingSuite);
describe('doc missing', docMissingSuite);
describe('doc missing and index readonly', docMissingAndIndexReadOnlySuite);
describe('doc exists', docExistsSuite);
Expand Down
172 changes: 0 additions & 172 deletions src/ui/ui_settings/routes/__tests__/index_missing.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/functional/apps/context/_filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import expect from 'expect.js';

const TEST_INDEX_PATTERN = 'logstash-*';
const TEST_ANCHOR_TYPE = 'doc';
const TEST_ANCHOR_TYPE = '_doc';
const TEST_ANCHOR_ID = 'AU_x3_BrGFA8no6QjjaI';
const TEST_ANCHOR_FILTER_FIELD = 'geo.src';
const TEST_ANCHOR_FILTER_VALUE = 'IN';
Expand Down
6 changes: 4 additions & 2 deletions test/functional/page_objects/context_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export function ContextPageProvider({ getService, getPageObjects }) {
hash: `${config.get('apps.context.hash')}/${indexPattern}/${anchorType}/${anchorId}?_a=${initialState}`,
});

log.debug(`browser.get(${appUrl})`);

await browser.get(appUrl);
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await this.waitUntilContextLoadingHasFinished();
Expand Down Expand Up @@ -91,8 +93,8 @@ export function ContextPageProvider({ getService, getPageObjects }) {
return await retry.try(async () => {
const successorLoadMoreButton = await this.getSuccessorLoadMoreButton();
const predecessorLoadMoreButton = await this.getPredecessorLoadMoreButton();
if (!(successorLoadMoreButton.isEnabled() && successorLoadMoreButton.isDisplayed() &&
predecessorLoadMoreButton.isEnabled() && predecessorLoadMoreButton.isDisplayed())) {
if (!(await successorLoadMoreButton.isEnabled() && await successorLoadMoreButton.isDisplayed() &&
await predecessorLoadMoreButton.isEnabled() && await predecessorLoadMoreButton.isDisplayed())) {
throw new Error('loading context rows');
}
});
Expand Down

0 comments on commit 93d5b81

Please sign in to comment.