# Restoring .kibana\_N indices into elasticsearch with an existing .kibana index

**URL:** <https://discuss.elastic.co/t/restoring-kibana-n-indices-into-elasticsearch-with-an-existing-kibana-index/172775>\
**Category:** Kibana\
**Created:** [March 18, 2019, 12:57pm UTC](https://discuss.elastic.co/t/restoring-kibana-n-indices-into-elasticsearch-with-an-existing-kibana-index/172775 "2019-03-18T12:57:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phandora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phandora/32/46108_2.png) [@Phandora](https://discuss.elastic.co/u/Phandora)\
**Post date:** [March 18, 2019, 12:57pm UTC](https://discuss.elastic.co/t/restoring-kibana-n-indices-into-elasticsearch-with-an-existing-kibana-index/172775/1 "2019-03-18T12:57:39Z")

</div>

Hi, I have been doing some testing to check how snapshots restore process works, but I’m facing some problems with .kibana index.

I have elasticsearch 6.5.4 version and .kibana indices are ".kibana\_N" (incremental) type. I created snapshots saving those .kibana-N indices. When trying to simulate an elasticsearch crash in a kubernetes environment, I do the following steps:

- Create a snapshot saving .kibana\* indices (.kibana does not exist. When doing "curl elasticsearch:9200/\_cat/indices?v" only .kibana\_N type is showed)
- Delete elasticsearch statefulset
- Start elasticsearch statefulset in a new persistent volume
- Check indices. "curl elasticsearch:9200/\_cat/indices?v" shows .kibana (not .kibana\_N). Of course elasticsearch and kibana versions are the same as before.
- Restore the previous snapshot

In that last step, an error is raised saying "TransportError(500, 'illegal\_state\_exception', 'index and alias names need to be unique, but the following duplicates were found [.kibana (alias of [.kibana\_1 ...]')"

The solution I found is to reindex .kibana\_1 into .kibana. Everything seems to work properly, but there are no .kibana\_N index anymore, so I am afraid I am changing the configuration doing that so, maybe, it would raise some errors in the future.

I would like to know why .kibana index is created after starting elasticsearch the second time, if the first one no .kibana was showed and also, Is it proper the way I am restoring .kibana\_N index? or it could be an inconvenience afterwards? I would like to be able to restore .kibana\_N indices keeping their original names.

Any piece of advice or help appreciated.

---

<div class="post-metadata">

**Author:** ![tiagocosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiagocosta/32/40045_2.png) [@tiagocosta](https://discuss.elastic.co/u/tiagocosta)\
**Post date:** [March 18, 2019, 6:26pm UTC](https://discuss.elastic.co/t/restoring-kibana-n-indices-into-elasticsearch-with-an-existing-kibana-index/172775/2 "2019-03-18T18:26:30Z")

</div>

Hi @Phandora,

I think every information you need is summarised here on the docs:

[https://www.elastic.co/guide/en/kibana/6.5/upgrade-migrations.html](https://www.elastic.co/guide/en/kibana/6.5/upgrade-migrations.html)

Cheers 😃

---

<div class="post-metadata">

**Author:** ![Phandora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phandora/32/46108_2.png) [@Phandora](https://discuss.elastic.co/u/Phandora)\
**Post date:** [March 19, 2019, 10:39am UTC](https://discuss.elastic.co/t/restoring-kibana-n-indices-into-elasticsearch-with-an-existing-kibana-index/172775/3 "2019-03-19T10:39:37Z")

</div>

Hi @tiagocosta, thank you for your quick response. I was aware of that information, but I do not understand well how I could apply that to my problem. I am quite new using Elasticsearch and Kibana, so maybe i have misunderstood the docs.

My problem was when I spin up elasticsearch again, a new .kibana index is created instead of a .kibana\_N one, even when my Kibana is already upgraded (I use the same versions for Elasticsearch and Kibana than before, 6.5+). My .kibana\_N indices (saved in snapshots) have .kibana as an alias, so when I try to restore them it raise and error saying .kibana (which actually exists in elasticsearch) is an alias for .kibana\_N.

It seems that spinning up kibana deployment after elasticsearch sts solves the problem, .kibana\_1 appears instead of .kibana. Thanks for your guidance.

---

<div class="post-metadata">

**Author:** ![tiagocosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiagocosta/32/40045_2.png) [@tiagocosta](https://discuss.elastic.co/u/tiagocosta)\
**Post date:** [March 19, 2019, 4:16pm UTC](https://discuss.elastic.co/t/restoring-kibana-n-indices-into-elasticsearch-with-an-existing-kibana-index/172775/4 "2019-03-19T16:16:30Z")

</div>

@Phandora I think your original Elasticsearch/Kibana setup has a problem. If it doesn't have the `.kibana` index only the `.kibana_N` ones it could mean that in the past any migration process doesn't have completed. I think the first step we could try it's just clone your current Elasticsearch and Kibana to another instances and there test the following:

- Clone Elasticsearch and Kibana to another isntances
- Stop Kibana completely
- Check what is your higher `.kibana_N` index with `curl localhost:9200/_cat/indices?v`
- Delete your higher `.kibana_N` index with `curl -X DELETE "localhost:9200/.kibana_N_MAX"`
- Start kibana and let the migration process finish before you stop kibana again.

You should now have the previous `.kibana_N_MAX` recreated and the `.kibana` index as an alias for `.kibana_N_MAX`

Then your backup/restore process of the indices should work

---

<div class="post-metadata">

**Author:** ![Phandora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phandora/32/46108_2.png) [@Phandora](https://discuss.elastic.co/u/Phandora)\
**Post date:** [March 19, 2019, 7:48pm UTC](https://discuss.elastic.co/t/restoring-kibana-n-indices-into-elasticsearch-with-an-existing-kibana-index/172775/5 "2019-03-19T19:48:04Z")

</div>

@tiagocosta I did not attempt any migration process, this environment is fully spinned up from:

- [docker.elastic.co/kibana/kibana:6.5.4](http://docker.elastic.co/kibana/kibana:6.5.4)

- [docker.elastic.co/elasticsearch/elasticsearch:6.5.4](http://docker.elastic.co/elasticsearch/elasticsearch:6.5.4)

When doing `curl localhost:9200/_cat/indices?v` , does it should show .kibana and .kibana\_N indices? I thought .kibana migrated to .kibana\_N after 6.5.0 version. It is weird though that .kibana\_1 does not show any aliases but, when I try to restore it, It says `duplicates were found [.kibana (alias of [.kibana_1 ...]')`

---

<div class="post-metadata">

**Author:** ![tiagocosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiagocosta/32/40045_2.png) [@tiagocosta](https://discuss.elastic.co/u/tiagocosta)\
**Post date:** [March 19, 2019, 8:27pm UTC](https://discuss.elastic.co/t/restoring-kibana-n-indices-into-elasticsearch-with-an-existing-kibana-index/172775/6 "2019-03-19T20:27:41Z")

</div>

@Phandora I thought you had already applied any migration before.

Anyway even in a blank installation for `6.5.4` you should start with `.kibana_1` index and `.kibana` alias for `.kibana_1`.

One thing that I wrote wrong before was the query to get the indices and the aliases.

`curl localhost:9200/_cat/aliases` should return the aliases

and `curl localhost:9200/_cat/indices`

So in a blank installation for 6.5.4 what is expected is:

```auto
curl localhost:9200/_cat/indices
-> green open .kibana_1 ....

```

and

```auto
curl localhost:9200/_cat/aliases
-> .kibana .kibana_1 - - -

```

After your snapshot restore, the state you need to have in your kibana indices is your previous kibana\_N indices + `.kibana` alias pointing to your higher kibana\_N one.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 16, 2019, 8:27pm UTC](https://discuss.elastic.co/t/restoring-kibana-n-indices-into-elasticsearch-with-an-existing-kibana-index/172775/7 "2019-04-16T20:27:47Z")

</div>

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