Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
parent
5691b6952e
commit
f8587ee209
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
||||
|
|
|
@ -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',
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue