# Kibana multitenant index management

**URL:** <https://forum.search-guard.com/t/kibana-multitenant-index-management/1994>\
**Category:** Search Guard\
**Created:** [October 19, 2020, 9:37am UTC](https://forum.search-guard.com/t/kibana-multitenant-index-management/1994 "2020-10-19T09:37:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![faxmodem](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/faxmodem/32/22_2.png) [@faxmodem](https://forum.search-guard.com/u/faxmodem)\
**Post date:** [October 19, 2020, 9:37am UTC](https://forum.search-guard.com/t/kibana-multitenant-index-management/1994/1 "2020-10-19T09:37:43Z")

</div>

After multiple upgrades, I now have a ton of kibana indices.  
For instance, these are just my private ones:

```auto
☠ GET _cat/indices/.kibana\*wernli\*
HTTP/1.1 200 OK
content-length: 540
content-type: text/plain; charset=UTF-8

green open .kibana_-460255123_fwernli-6_9 yVU6btb3T5qqFNmAggpVjg 1 1 4 0 149.7kb 74.8kb
green open .kibana_-460255123_fwernli-6_7 RSLHmXyCRlCgskTVqNvOHA 1 1 4 0 140kb 70kb
green open .kibana_-460255123_fwernli_1 -xOkZrODSBa1p5X2VrksRQ 1 1 7 0 156.1kb 78kb
green open .kibana_-460255123_fwernli_3 EgDf-ha6QN-tLdC2EhCOBw 1 1 13 1 368.9kb 184.5kb
green open .kibana_-460255123_fwernli-6_8 LOmwNGkCTz6BSOGQQNHlQw 1 1 4 0 140kb 70kb
green open .kibana_-460255123_fwernli_2 4Z1KBojjQhuoa_bOAtAmnQ 1 1 11 1 361kb 180.5kb

☠ GET _cat/aliases/.kibana\*wernli\*
HTTP/1.1 200 OK
content-length: 132
content-type: text/plain; charset=UTF-8

.kibana_-460255123_fwernli .kibana_-460255123_fwernli_3 - - -
.kibana_-460255123_fwernli-6 .kibana_-460255123_fwernli-6_9 - - -

```

Which ones are really used ?  
Which ones can I safely DELETE ?

---

<div class="post-metadata">

**Author:** ![srgbnd](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/srgbnd/32/506_2.png) [@srgbnd](https://forum.search-guard.com/u/srgbnd)\
**Post date:** [October 19, 2020, 10:15am UTC](https://forum.search-guard.com/t/kibana-multitenant-index-management/1994/2 "2020-10-19T10:15:27Z")

</div>

After migration fulfilled, there will be multiple Kibana indices in Elasticsearch: .kibana\_-id\_tenant-1, .kibana\_-id\_tenant-2, etc. Kibana only uses the index that the .kibana\_-id\_tenant alias points to. In your case they are .kibana\_-460255123\_fwernli\_3 and .kibana\_-460255123\_fwernli-6\_9. The other indices can be safely deleted, but are left for the historical record, and to help rolling Kibana back to previous versions. Also, you can delete indices if the related tenant, for example, fwernli isn’t used anymore and you don’t need the data.

It works exactly like the .kibana index migration [Upgrade migrations | Kibana Guide [8.4] | Elastic](https://www.elastic.co/guide/en/kibana/current/upgrade-migrations.html#upgrade-migrations-old-indices)

---

<div class="post-metadata">

**Author:** ![faxmodem](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/faxmodem/32/22_2.png) [@faxmodem](https://forum.search-guard.com/u/faxmodem)\
**Post date:** [October 19, 2020, 11:55am UTC](https://forum.search-guard.com/t/kibana-multitenant-index-management/1994/3 "2020-10-19T11:55:44Z")

</div>

Thanks! But why are there two aliases `_3` and `6_9` ?

---

<div class="post-metadata">

**Author:** ![srgbnd](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/srgbnd/32/506_2.png) [@srgbnd](https://forum.search-guard.com/u/srgbnd)\
**Post date:** [October 19, 2020, 12:05pm UTC](https://forum.search-guard.com/t/kibana-multitenant-index-management/1994/4 "2020-10-19T12:05:36Z")

</div>

SearchGuard (SG) calls the Kibana migration service in order to do the migrations. The last id in the index name is added by the Kibana migration service and it is not part of the SG code.

What versions of the Kibana did you have, in historical order? I guess it was v6.7, v6.8, v6.9, and 7.n where n is an integer from 0 to 9 included. Am I right? Kibana changed the migration implementation in v7. Probably it will change it again soon because it is not good enough. Read this RFC if you want to know more [https://github.com/elastic/kibana/blob/master/rfcs/text/0013\_saved\_object\_migrations.md](https://github.com/elastic/kibana/blob/master/rfcs/text/0013_saved_object_migrations.md)

---

<div class="post-metadata">

**Author:** ![faxmodem](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/faxmodem/32/22_2.png) [@faxmodem](https://forum.search-guard.com/u/faxmodem)\
**Post date:** [October 19, 2020, 12:21pm UTC](https://forum.search-guard.com/t/kibana-multitenant-index-management/1994/5 "2020-10-19T12:21:41Z")

</div>

We’re not yet at 7 in this cluster. It was probably 2.x to 5.y then a few 6.z versions.  
So I have to keep both ?

---

<div class="post-metadata">

**Author:** ![srgbnd](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/srgbnd/32/506_2.png) [@srgbnd](https://forum.search-guard.com/u/srgbnd)\
**Post date:** [October 19, 2020, 1:46pm UTC](https://forum.search-guard.com/t/kibana-multitenant-index-management/1994/6 "2020-10-19T13:46:14Z")

</div>

If you don’t think of rollback, you can leave only the indices you have aliases for. In your example they are .kibana\_-460255123\_fwernli\_3 and .kibana\_-460255123\_fwernli-6\_9.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/system/32/1870_2.png) [@system](https://forum.search-guard.com/u/system)\
**Post date:** [November 9, 2020, 1:46pm UTC](https://forum.search-guard.com/t/kibana-multitenant-index-management/1994/7 "2020-11-09T13:46:15Z")

</div>

Closed on November 9, 2020, 1:46pm UTC

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
