* [npm] upgrade elasticsearch/elasticsearch-browser packages * [es/patchKibanaIndex] update tests to expect indices.getMapping * [npm] use ^ version range for elasticsearch(-browser) packages * [es/patchKibanaIndex/tests] expand assertion
This commit is contained in:
parent
9afc7511a9
commit
5dd87e54db
|
@ -115,8 +115,8 @@
|
|||
"d3": "3.5.6",
|
||||
"d3-cloud": "1.2.1",
|
||||
"dragula": "3.7.0",
|
||||
"elasticsearch": "13.0.1",
|
||||
"elasticsearch-browser": "13.0.1",
|
||||
"elasticsearch": "^14.2.0",
|
||||
"elasticsearch-browser": "^14.2.0",
|
||||
"encode-uri-query": "1.0.0",
|
||||
"even-better": "7.0.2",
|
||||
"expiry-js": "0.1.7",
|
||||
|
@ -272,7 +272,7 @@
|
|||
"leadfoot": "1.7.1",
|
||||
"license-checker": "^16.0.0",
|
||||
"load-grunt-config": "0.19.2",
|
||||
"makelogs": "^4.0.3",
|
||||
"makelogs": "^4.0.4",
|
||||
"marked-text-renderer": "0.1.0",
|
||||
"mocha": "3.3.0",
|
||||
"mock-fs": "^4.4.2",
|
||||
|
|
|
@ -45,15 +45,17 @@ function createIndex(name, mappings = {}) {
|
|||
function createCallCluster(index) {
|
||||
return sinon.spy(async (method, params) => {
|
||||
switch (method) {
|
||||
case 'indices.get':
|
||||
case 'indices.getMapping':
|
||||
if (!index) {
|
||||
return { status: 404 };
|
||||
} else {
|
||||
expect(params).to.have.property('index', Object.keys(index)[0]);
|
||||
return cloneDeep(index);
|
||||
}
|
||||
|
||||
case 'indices.putMapping':
|
||||
return { ok: true };
|
||||
|
||||
default:
|
||||
throw new Error(`stub not expecting callCluster('${method}')`);
|
||||
}
|
||||
|
@ -62,7 +64,7 @@ function createCallCluster(index) {
|
|||
|
||||
describe('es/healthCheck/patchKibanaIndex()', () => {
|
||||
describe('general', () => {
|
||||
it('reads the _mappings feature of the indexName', async () => {
|
||||
it('reads the mapping for the indexName', async () => {
|
||||
const indexName = chance.word();
|
||||
const mappings = createRandomMappings();
|
||||
const callCluster = createCallCluster(createIndex(indexName, mappings));
|
||||
|
@ -74,8 +76,9 @@ describe('es/healthCheck/patchKibanaIndex()', () => {
|
|||
});
|
||||
|
||||
sinon.assert.calledOnce(callCluster);
|
||||
sinon.assert.calledWithExactly(callCluster, 'indices.get', sinon.match({
|
||||
feature: '_mappings'
|
||||
sinon.assert.calledWithExactly(callCluster, 'indices.getMapping', sinon.match({
|
||||
ignore: [404],
|
||||
index: indexName,
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
@ -139,7 +142,7 @@ describe('es/healthCheck/patchKibanaIndex()', () => {
|
|||
});
|
||||
|
||||
sinon.assert.calledOnce(callCluster);
|
||||
sinon.assert.calledWithExactly(callCluster, 'indices.get', sinon.match({ index: indexName }));
|
||||
sinon.assert.calledWithExactly(callCluster, 'indices.getMapping', sinon.match({ index: indexName }));
|
||||
});
|
||||
|
||||
it('adds properties that are not in index', async () => {
|
||||
|
@ -159,7 +162,7 @@ describe('es/healthCheck/patchKibanaIndex()', () => {
|
|||
});
|
||||
|
||||
sinon.assert.calledTwice(callCluster);
|
||||
sinon.assert.calledWithExactly(callCluster, 'indices.get', sinon.match({ index: indexName }));
|
||||
sinon.assert.calledWithExactly(callCluster, 'indices.getMapping', sinon.match({ index: indexName }));
|
||||
sinon.assert.calledWithExactly(callCluster, 'indices.putMapping', sinon.match({
|
||||
index: indexName,
|
||||
type: getRootType(mappings),
|
||||
|
@ -181,7 +184,7 @@ describe('es/healthCheck/patchKibanaIndex()', () => {
|
|||
});
|
||||
|
||||
sinon.assert.calledTwice(callCluster);
|
||||
sinon.assert.calledWithExactly(callCluster, 'indices.get', sinon.match({
|
||||
sinon.assert.calledWithExactly(callCluster, 'indices.getMapping', sinon.match({
|
||||
index: indexName
|
||||
}));
|
||||
sinon.assert.calledWithExactly(callCluster, 'indices.putMapping', sinon.match({
|
||||
|
|
|
@ -64,9 +64,8 @@ export async function patchKibanaIndex(options) {
|
|||
* @return {EsMappingsDsl|undefined}
|
||||
*/
|
||||
async function getCurrentMappings(callCluster, indexName, rootEsType) {
|
||||
const response = await callCluster('indices.get', {
|
||||
const response = await callCluster('indices.getMapping', {
|
||||
index: indexName,
|
||||
feature: '_mappings',
|
||||
ignore: [404],
|
||||
});
|
||||
|
||||
|
|
|
@ -23,9 +23,8 @@ export async function saveAction({ name, indices, client, dataDir, log }) {
|
|||
log.info('[%s] Creating archive of %j', name, indices);
|
||||
|
||||
await fromNode(cb => mkdirp(outputDir, cb));
|
||||
const resolvedIndexes = Object.keys(await client.indices.get({
|
||||
const resolvedIndexes = Object.keys(await client.indices.getSettings({
|
||||
index: indices,
|
||||
feature: ['_settings'],
|
||||
filterPath: ['*.settings.index.uuid']
|
||||
}));
|
||||
|
||||
|
|
49
yarn.lock
49
yarn.lock
|
@ -263,9 +263,11 @@ agent-base@^4.1.0:
|
|||
dependencies:
|
||||
es6-promisify "^5.0.0"
|
||||
|
||||
agentkeepalive@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-2.2.0.tgz#c5d1bd4b129008f1163f236f86e5faea2026e2ef"
|
||||
agentkeepalive@^3.4.1:
|
||||
version "3.4.1"
|
||||
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-3.4.1.tgz#aa95aebc3a749bca5ed53e3880a09f5235b48f0c"
|
||||
dependencies:
|
||||
humanize-ms "^1.2.1"
|
||||
|
||||
ajv-keywords@^1.0.0:
|
||||
version "1.5.1"
|
||||
|
@ -3337,26 +3339,15 @@ ejs@^2.2.4:
|
|||
version "2.5.7"
|
||||
resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a"
|
||||
|
||||
elasticsearch-browser@13.0.1:
|
||||
version "13.0.1"
|
||||
resolved "https://registry.yarnpkg.com/elasticsearch-browser/-/elasticsearch-browser-13.0.1.tgz#dece9a8bf608ad2e5574b82b01b28755e1946455"
|
||||
elasticsearch-browser@^14.2.0:
|
||||
version "14.2.0"
|
||||
resolved "https://registry.yarnpkg.com/elasticsearch-browser/-/elasticsearch-browser-14.2.0.tgz#4437d2c97457dc019e77e54d9a174ed760b319a6"
|
||||
|
||||
elasticsearch@13.0.1:
|
||||
version "13.0.1"
|
||||
resolved "https://registry.yarnpkg.com/elasticsearch/-/elasticsearch-13.0.1.tgz#fa58204233052c4cd221e8721e48f3906b385b32"
|
||||
elasticsearch@^14.2.0:
|
||||
version "14.2.0"
|
||||
resolved "https://registry.yarnpkg.com/elasticsearch/-/elasticsearch-14.2.0.tgz#ef7c6e505cb41525a0751b5156e8c0fbd1f02d62"
|
||||
dependencies:
|
||||
agentkeepalive "^2.2.0"
|
||||
chalk "^1.0.0"
|
||||
lodash "2.4.2"
|
||||
lodash.get "^4.4.2"
|
||||
lodash.isempty "^4.4.0"
|
||||
lodash.trimend "^4.5.1"
|
||||
|
||||
elasticsearch@^13.0.0-beta2:
|
||||
version "13.3.1"
|
||||
resolved "https://registry.yarnpkg.com/elasticsearch/-/elasticsearch-13.3.1.tgz#c530aea9afb17ea91c3d0a56f1f111ba49bc9239"
|
||||
dependencies:
|
||||
agentkeepalive "^2.2.0"
|
||||
agentkeepalive "^3.4.1"
|
||||
chalk "^1.0.0"
|
||||
lodash "2.4.2"
|
||||
lodash.get "^4.4.2"
|
||||
|
@ -5327,6 +5318,12 @@ https-proxy-agent@2.1.1:
|
|||
agent-base "^4.1.0"
|
||||
debug "^3.1.0"
|
||||
|
||||
humanize-ms@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed"
|
||||
dependencies:
|
||||
ms "^2.0.0"
|
||||
|
||||
husky@0.8.1:
|
||||
version "0.8.1"
|
||||
resolved "https://registry.yarnpkg.com/husky/-/husky-0.8.1.tgz#ecc797b8c4c6893a33f48703bc97a9a5e50d860f"
|
||||
|
@ -7419,13 +7416,13 @@ makeerror@1.0.x:
|
|||
dependencies:
|
||||
tmpl "1.0.x"
|
||||
|
||||
makelogs@^4.0.3:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/makelogs/-/makelogs-4.0.3.tgz#f9b4510cfa9cc6875314833c320ad60b51f8f6cb"
|
||||
makelogs@^4.0.4:
|
||||
version "4.0.4"
|
||||
resolved "https://registry.yarnpkg.com/makelogs/-/makelogs-4.0.4.tgz#feae63a6a4627f85c1464672672e16293ddc05f0"
|
||||
dependencies:
|
||||
async "^1.4.2"
|
||||
bluebird "^2.10.0"
|
||||
elasticsearch "^13.0.0-beta2"
|
||||
elasticsearch "^14.2.0"
|
||||
inquirer "^0.11.1"
|
||||
lodash "~2.4.1"
|
||||
moment "^2.10.6"
|
||||
|
@ -7787,7 +7784,7 @@ ms@2.0.0:
|
|||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||
|
||||
ms@2.1.1:
|
||||
ms@2.1.1, ms@^2.0.0:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
|
||||
|
||||
|
|
Loading…
Reference in a new issue