mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Adjust extend_es_archiver to handle additional cases (#79308)
This PR enables the extend_es_archiver to recognize additional indices like .kibana_1 as well as a list of indices.
This commit is contained in:
parent
86cb97adf6
commit
819ccf1247
1 changed files with 7 additions and 1 deletions
|
@ -33,9 +33,15 @@ export function extendEsArchiver({ esArchiver, kibanaServer, retry, defaults })
|
|||
// esArchiver methods return a stats object, with information about the indexes created
|
||||
const stats = await originalMethod.apply(esArchiver, args);
|
||||
|
||||
const statsKeys = Object.keys(stats);
|
||||
const kibanaKeys = statsKeys.filter(
|
||||
// this also matches stats keys like '.kibana_1' and '.kibana_2,.kibana_1'
|
||||
(key) => key.includes(KIBANA_INDEX) && (stats[key].created || stats[key].deleted)
|
||||
);
|
||||
|
||||
// if the kibana index was created by the esArchiver then update the uiSettings
|
||||
// with the defaults to make sure that they are always in place initially
|
||||
if (stats[KIBANA_INDEX] && (stats[KIBANA_INDEX].created || stats[KIBANA_INDEX].deleted)) {
|
||||
if (kibanaKeys.length > 0) {
|
||||
await retry.try(async () => {
|
||||
await kibanaServer.uiSettings.update(defaults);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue