# Is it possible to delete security index and then create it automatically on restart of Elasticsearch

**URL:** https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434
**Category:** Elasticsearch
**Tags:** elastic-stack-security
**Created:** [January 4, 2023, 8:41am UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434 "2023-01-04T08:41:11Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![smiley\_tamy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smiley_tamy/32/113375_2.png) [@smiley\_tamy](https://discuss.elastic.co/u/smiley_tamy)
#### Post date: [January 4, 2023, 8:41am UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/1 "2023-01-04T08:41:11Z")

</div>

x pack is enabled and now I want to delete security index.  
Then will it be automatically created on restart of Elasticsearch and will all the built users be created?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 4, 2023, 8:58am UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/2 "2023-01-04T08:58:14Z")

</div>

What are you trying to achieve by doing this?

Which version of Elasticsearch are you using?

If you remove the security index i believe all security configuration, including users and roles, will be deleted and it will be difficult to get the cluster up and running again.

---

<div class="post-metadata">

### Author: ![smiley\_tamy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smiley_tamy/32/113375_2.png) [@smiley\_tamy](https://discuss.elastic.co/u/smiley_tamy)
#### Post date: [January 4, 2023, 9:10am UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/3 "2023-01-04T09:10:02Z")

</div>

Elastic version - 8.5.2  
I want to clear all the data of security index  
I have a user and I forgot the password of that user who is a superuser and manages my application data.  
Is there any way to reset the password without providing old credentials.

Or If I use elastic user, I want to change its password via API  
without providing previous credentials

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 4, 2023, 9:48am UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/4 "2023-01-04T09:48:12Z")

</div>

I do not know for sure, but it sounds like the behavoiur you are asking for would be a potential security vulnerability.

---

<div class="post-metadata">

### Author: ![smiley\_tamy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smiley_tamy/32/113375_2.png) [@smiley\_tamy](https://discuss.elastic.co/u/smiley_tamy)
#### Post date: [January 4, 2023, 9:50am UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/5 "2023-01-04T09:50:25Z")

</div>

Hmm.. It can be a security vulnerability  
Can we use anonymous access to change password without credentials  
[Enabling anonymous access | Elasticsearch Guide [8.5] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/anonymous-access.html)

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 4, 2023, 9:52am UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/6 "2023-01-04T09:52:05Z")

</div>

If anyone could log in and change passwords through anonymous access there would not be much point in having secured the cluster in the first place, would it?

---

<div class="post-metadata">

### Author: ![smiley\_tamy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smiley_tamy/32/113375_2.png) [@smiley\_tamy](https://discuss.elastic.co/u/smiley_tamy)
#### Post date: [January 4, 2023, 9:53am UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/7 "2023-01-04T09:53:02Z")

</div>

Yeah.. that's true

---

<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: [January 5, 2023, 4:49am UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/8 "2023-01-05T04:49:53Z")

</div>

> **[elasticsearch-reset-password | Elasticsearch Guide \[8.5\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/reset-password.html)**

---

<div class="post-metadata">

### Author: ![smiley\_tamy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smiley_tamy/32/113375_2.png) [@smiley\_tamy](https://discuss.elastic.co/u/smiley_tamy)
#### Post date: [January 16, 2023, 7:47pm UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/9 "2023-01-16T19:47:24Z")

</div>

Thank you for the information .. This works with the batch files. But I think via API we cannot do that

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [January 16, 2023, 7:57pm UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/10 "2023-01-16T19:57:34Z")

</div>

Hi @smiley_tamy Correct, You can not reset the password of any of the built-in users via the API only via the command line tools.

---

<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: [February 13, 2023, 7:58pm UTC](https://discuss.elastic.co/t/is-it-possible-to-delete-security-index-and-then-create-it-automatically-on-restart-of-elasticsearch/322434/11 "2023-02-13T19:58:03Z")

</div>

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