enrise-estools
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "enrise-estools", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Elasticsearch tooling functions for managing indices and aliases.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,3 +13,3 @@ 'use strict'; | ||
if (aliases.length > 1) { | ||
throw new Error('Multiple aliases recieved'); | ||
throw new Error('Multiple aliases received'); | ||
} | ||
@@ -48,2 +48,3 @@ | ||
// we don't need (aliases=manual, warmers we don't use) | ||
// Scrubs those settings that elasticsearch does not accept as input when creating a new index | ||
function getMapping(esClient, index) { | ||
@@ -54,3 +55,10 @@ return esClient.indices.get({index}) | ||
mappings: indexInfo[index].mappings | ||
})); | ||
})) | ||
.then(mapping => { | ||
delete mapping.settings.index.creation_date; | ||
delete mapping.settings.index.uuid; | ||
delete mapping.settings.index.provided_name; | ||
delete mapping.settings.index.version; | ||
return mapping; | ||
}); | ||
} | ||
@@ -57,0 +65,0 @@ |
@@ -25,3 +25,3 @@ 'use strict'; | ||
describe('getAliasVersion', () => { | ||
it('throws an error if multiple aliases are reseived', mochaAsync(async () => { | ||
it('throws an error if multiple aliases are received', mochaAsync(async () => { | ||
esClient.indices.getAlias.resolves({ | ||
@@ -38,3 +38,3 @@ 'enrise.nl-nl-v1': {}, | ||
chai.expect(err).to.be.an.instanceof(Error); | ||
chai.expect(err.message).to.equal('Multiple aliases recieved'); | ||
chai.expect(err.message).to.equal('Multiple aliases received'); | ||
} | ||
@@ -139,6 +139,12 @@ })); | ||
it('retrieves the settings mapping from an index', mochaAsync(async () => { | ||
it('retrieves the usefull settings mapping from an index', mochaAsync(async () => { | ||
esClient.indices.get.resolves({ | ||
'enrise.nl-nl-v2': { | ||
settings: {the: 'settings'}, | ||
settings: {index: { | ||
uuid: 'a', | ||
provided_name: 'b', | ||
creation_date: 'f', | ||
number_of_shards: '2', | ||
version: {created: '12321'} | ||
}}, | ||
mappings: {the: 'mappings'}, | ||
@@ -154,3 +160,3 @@ aliases: {the: 'aliases'}, | ||
chai.expect(result).to.deep.equal({ | ||
settings: {the: 'settings'}, | ||
settings: {index: {number_of_shards: '2'}}, | ||
mappings: {the: 'mappings'} | ||
@@ -157,0 +163,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38355
797