# Accidentally deleted .security index for x-pack

**URL:** https://discuss.elastic.co/t/accidentally-deleted-security-index-for-x-pack/69844
**Category:** Elasticsearch
**Created:** [December 22, 2016, 9:19pm UTC](https://discuss.elastic.co/t/accidentally-deleted-security-index-for-x-pack/69844 "2016-12-22T21:19:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Johntdyer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johntdyer/32/3424_2.png) [@Johntdyer](https://discuss.elastic.co/u/Johntdyer)
#### Post date: [December 22, 2016, 9:19pm UTC](https://discuss.elastic.co/t/accidentally-deleted-security-index-for-x-pack/69844/1 "2016-12-22T21:19:26Z")

</div>

So by some horrible error we deleted the .security index for x-pack. How do we get that back? We tried reinstalling in a lab deployment and it didnt seem to recover that index.

---

<div class="post-metadata">

### Author: ![Johntdyer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johntdyer/32/3424_2.png) [@Johntdyer](https://discuss.elastic.co/u/Johntdyer)
#### Post date: [December 22, 2016, 9:20pm UTC](https://discuss.elastic.co/t/accidentally-deleted-security-index-for-x-pack/69844/2 "2016-12-22T21:20:54Z")

</div>

nm, it seems to have come back

---

<div class="post-metadata">

### Author: ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)
#### Post date: [December 23, 2016, 7:24am UTC](https://discuss.elastic.co/t/accidentally-deleted-security-index-for-x-pack/69844/3 "2016-12-23T07:24:13Z")

</div>

For reference, in case anyone stumbles upon this thread, X-Pack automatically creates the `.security` index as needed, and you shouldn't need to reinstall the X-Pack plugin to resolve this sort of issue.

Assuming you don't have a snapshot that you can/want to restore from, then the safest/easiest course of action is:

1. Restart your cluster. This step will clear the security caches and make it easier to work with, and it will make sure the template for your security index is present and up to date. This will not automatically create the `.security` index.
2. From a security point of view, you now have a "new" cluster, so the reserved users `elastic` and `kibana` will have reset to their default _"changeme"_ passwords.
3. Follow the [standard instructions](https://www.elastic.co/guide/en/x-pack/current/setting-up-authentication.html#built-in-users) for setting the passwords for the _elastic_ and _kibana_ users.
4. When you set the passwords for those users, X-Pack will automatically create the `.security` index.
5. Re-create any other users and roles that you need in the [native realm](https://www.elastic.co/guide/en/x-pack/current/native-realm.html)

Obviously, if you have a [snapshot](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html) that you can restore from that will be better than rebuilding your security realms from scratch.

---

<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: [January 20, 2017, 7:24am UTC](https://discuss.elastic.co/t/accidentally-deleted-security-index-for-x-pack/69844/4 "2017-01-20T07:24:32Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Toby-Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/toby-elastic/32/56715_2.png) [@Toby-Elastic](https://discuss.elastic.co/u/Toby-Elastic)
#### Post date: [March 30, 2022, 12:29pm UTC](https://discuss.elastic.co/t/accidentally-deleted-security-index-for-x-pack/69844/5 "2022-03-30T12:29:45Z")

</div>

For step number 3 the instructions for 7.x are documented at [elasticsearch-setup-passwords | Elasticsearch Guide [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/setup-passwords.html).
