[migrations] Disable replicas (#25274) (#25357)

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
Tyler Smalley 2018-11-07 19:40:27 -08:00 committed by GitHub
parent 5691b6952e
commit f8587ee209
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 7 deletions

View file

@ -87,10 +87,8 @@ export interface IndexCreationOpts {
body?: {
mappings?: IndexMapping;
settings?: {
index: {
number_of_shards: string;
number_of_replicas: string;
};
number_of_shards: number;
auto_expand_replicas: string;
};
};
}

View file

@ -98,7 +98,10 @@ describe('ElasticIndex', () => {
test('calls indices.create', async () => {
const callCluster = sinon.spy(async (path: string, { body, index }: any) => {
expect(path).toEqual('indices.create');
expect(body).toEqual({ mappings: { foo: 'bar' } });
expect(body).toEqual({
mappings: { foo: 'bar' },
settings: { auto_expand_replicas: '0-1', number_of_shards: 1 },
});
expect(index).toEqual('.abcd');
});
@ -248,6 +251,7 @@ describe('ElasticIndex', () => {
properties: { foo: 'bar' },
},
},
settings: { auto_expand_replicas: '0-1', number_of_shards: 1 },
});
expect(arg.index).toEqual('.ze-index');
return true;

View file

@ -31,6 +31,8 @@ import { AliasAction, CallCluster, IndexMapping, NotFound, RawDoc } from './call
// tslint:disable-next-line:no-var-requires
const { getTypes } = require('../../../mappings');
const settings = { number_of_shards: 1, auto_expand_replicas: '0-1' };
export interface FullIndexInfo {
aliases: { [name: string]: object };
exists: boolean;
@ -213,7 +215,7 @@ export async function createIndex(
index: string,
mappings?: IndexMapping
) {
await callCluster('indices.create', { body: { mappings }, index });
await callCluster('indices.create', { body: { mappings, settings }, index });
}
export async function deleteIndex(callCluster: CallCluster, index: string) {
@ -236,7 +238,7 @@ export async function convertToAlias(
batchSize: number
) {
await callCluster('indices.create', {
body: { mappings: info.mappings },
body: { mappings: info.mappings, settings },
index: info.indexName,
});

View file

@ -86,6 +86,7 @@ describe('IndexMigrator', () => {
},
},
},
settings: { number_of_shards: 1, auto_expand_replicas: '0-1' },
},
index: '.kibana_1',
});
@ -197,6 +198,7 @@ describe('IndexMigrator', () => {
},
},
},
settings: { number_of_shards: 1, auto_expand_replicas: '0-1' },
},
index: '.kibana_2',
});