How to disable the new index creation mechanism whenever I ran Kibana 7.5.1?

Unlike in Kibana 6, I keep getting new indexes generated whenever I run my Kibana 7.5.1 instance
.kibana_1, .kibana_2 etc.
Why is it happening? can I disable it? it costs a lot of time and space to my development process

thanks for the help.

We've made it safer to upgrade Kibana versions since Kibana 6, and these indices are a part of our migration system. It will only create a new .kibana index if necessary, not every time. Read more about it here: https://www.elastic.co/guide/en/kibana/current/upgrade-migrations.html

As documented on that page, only the highest .kibana_N value is used. So if you have .kibana_2, it is safe to delete .kibana_1 unless you want to roll back.

The thing is that it is causing issues on my instance that didnt happen when I used Kibana 6 -
when first migration is done, it start creating a new migration and after the second migration is done I cannot get to the kibana app at all (the entire process takes about 40 minutes).
Any suggestions where I should look for the answer in order to fix it? what could go wrong there?
attached is the log from my run:

log [15:36:03.982] [info][plugins-service] Plugin "newsfeed" is disabled.
log [15:36:04.056] [info][plugins-service] Plugin initialization disabled.
log [15:36:42.779] [warning][legacy-plugins] Skipping non-plugin directory at C:\work\kibana7\custom-kibana-7.5.1\src\legacy\core_plugins\visualizations
log [15:36:42.798] [warning][legacy-plugins] Skipping non-plugin directory at C:\work\kibana7\custom-kibana-7.5.1\src\legacy\core_plugins\vis_type_metric
log [15:36:46.896] [info][migrations] Creating index .kibana_15.
log [15:36:47.287] [info][migrations] Migrating .kibana_14 saved objects to .kibana_15
log [15:54:42.336] [info][migrations] Pointing alias .kibana_localdev to .kibana_15.
log [15:54:45.311] [info][migrations] Finished in 1078760ms.
watching for changes (4547 files)
log [15:54:53.554] [info][server] basepath proxy server running at http://127.0.0.1:5601/flm
optmzr log [15:54:59.880] [warning][plugins-discovery] Explicit plugin paths [C:\work\kibana7\custom-kibana-7.5.1\x-pack] are only supported in development. Relative imports will not work in production.
server log [15:54:59.892] [warning][plugins-discovery] Explicit plugin paths [C:\work\kibana7\custom-kibana-7.5.1\x-pack] are only supported in development. Relative imports will not work in production.
optmzr log [15:55:00.462] [info][plugins-service] Plugin "newsfeed" is disabled.
server log [15:55:00.475] [info][plugins-service] Plugin "newsfeed" is disabled.
optmzr log [15:55:00.499] [info][plugins-service] Plugin initialization disabled.
server log [15:55:00.548] [info][plugins-system] Setting up [15] plugins: [licensing,code,security,timelion,features,spaces,testbed,translations,uiActions,expressions,inspector,embeddable,advancedUiActions,eui_utils,data]
server log [15:55:00.549] [info][licensing][plugins] Setting up plugin
server log [15:55:00.555] [info][code][plugins] Setting up plugin
server log [15:55:00.557] [info][plugins][security] Setting up plugin
server log [15:55:00.559] [warning][config][plugins][security] Session cookies will be transmitted over insecure connections. This is not recommended.
server log [15:55:00.570] [info][plugins][timelion] Setting up plugin
server log [15:55:00.581] [info][features][plugins] Setting up plugin
server log [15:55:00.595] [info][plugins][spaces] Setting up plugin
server log [15:55:00.600] [info][plugins][testbed] Setting up plugin
server log [15:55:00.609] [info][plugins][translations] Setting up plugin
server log [15:55:00.611] [info][data][plugins] Setting up plugin
optmzr log [15:55:13.211] [warning][legacy-plugins] Skipping non-plugin directory at C:\work\kibana7\custom-kibana-7.5.1\src\legacy\core_plugins\visualizations
optmzr log [15:55:13.219] [warning][legacy-plugins] Skipping non-plugin directory at C:\work\kibana7\custom-kibana-7.5.1\src\legacy\core_plugins\vis_type_metric
server log [15:55:13.275] [warning][legacy-plugins] Skipping non-plugin directory at C:\work\kibana7\custom-kibana-7.5.1\src\legacy\core_plugins\visualizations
server log [15:55:13.308] [warning][legacy-plugins] Skipping non-plugin directory at C:\work\kibana7\custom-kibana-7.5.1\src\legacy\core_plugins\vis_type_metric
server log [15:55:15.213] [info][plugins-system] Starting [9] plugins: [licensing,code,security,timelion,features,spaces,testbed,translations,data]
server log [15:55:15.225] [info][licensing][plugins] Imported changed license information from Elasticsearch for the [data] cluster: type: basic | status: active
optmzr log [15:55:16.624] [info][migrations] Creating index .kibana_16.
server log [15:55:16.800] [info][migrations] Creating index .kibana_16.
optmzr log [15:55:16.972] [info][migrations] Migrating .kibana_15 saved objects to .kibana_16
server log [15:55:17.068] [warning][migrations] Unable to connect to Elasticsearch. Error: [resource_already_exists_exception] index [.kibana_16/LoohurI-TZ-k_GO2XBKpMA] already
exists, with { index_uuid="LoohurI-TZ-k_GO2XBKpMA" & index=".kibana_16" }
server log [15:55:17.069] [warning][migrations] Another Kibana instance appears to be migrating the index. Waiting for that migration to complete. If no other Kibana instance is attempting migrations, you can get past this message by deleting index .kibana_16 and restarting Kibana.
optmzr log [16:18:15.238] [info][migrations] Pointing alias .kibana_localdev to .kibana_16.
optmzr log [16:18:17.784] [info][migrations] Finished in 1381392ms.
optmzr log [16:18:33.696] [info][optimize:dynamic_dll_plugin] Started dynamic dll plugin tasks
optmzr log [16:18:34.106] [info] Plugin initialization disabled.
optmzr log [16:18:34.117] [info][optimize] Optimization started
Browserslist: caniuse-lite is outdated. Please run next command yarn upgrade
Browserslist: caniuse-lite is outdated. Please run next command yarn upgrade
Browserslist: caniuse-lite is outdated. Please run next command yarn upgrade
Browserslist: caniuse-lite is outdated. Please run next command yarn upgrade
Browserslist: caniuse-lite is outdated. Please run next command yarn upgrade
Browserslist: caniuse-lite is outdated. Please run next command yarn upgrade
Browserslist: caniuse-lite is outdated. Please run next command yarn upgrade
optmzr log [16:19:20.563] [info][optimize:dynamic_dll_plugin] No need to compile client vendors dll
optmzr log [16:19:20.565] [info][optimize:dynamic_dll_plugin] Finished all dynamic dll plugin tasks
optmzr log [16:19:20.578] [info][optimize] Optimization success in 46.47 seconds

This looks to be caused by your custom plugins, not part of the default Kibana instance. Please try reading the full documentation I sent earlier to learn about how the migration system works in Kibana 7.

It appears as if Kibana is performing a new migration every time the process is restarted, this is not the expected behaviour - it should only perform a migration once (if required) after upgrading.

There are two possible causes:

  1. You have a mappings template with an index pattern that matches .kibana*. If so, remove the mappings template to test, Kibana will perform one more migration, but after the second restart should not perform another migration. If you've confirmed that this is the problem, you can add back the mappings template but narrow down the index pattern so that it doesn't match .kibana* anymore.
  2. You have a corrupt saved object which Kibana is unable to migrate. https://github.com/elastic/kibana/issues/65612 We've added logging when such an object is encountered in v7.8 https://github.com/elastic/kibana/pull/65829. So the easiest way to confirm is to install 7.8.0 and watch the logs. To fix the problem remove the corrupt saved object document from Elasticsearch.