# How to delete system indices?

**URL:** <https://discuss.elastic.co/t/how-to-delete-system-indices/338510>\
**Category:** Elasticsearch\
**Created:** [July 17, 2023, 8:07am UTC](https://discuss.elastic.co/t/how-to-delete-system-indices/338510 "2023-07-17T08:07:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lusynda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lusynda/32/53557_2.png) [@lusynda](https://discuss.elastic.co/u/lusynda)\
**Post date:** [July 17, 2023, 8:07am UTC](https://discuss.elastic.co/t/how-to-delete-system-indices/338510/1 "2023-07-17T08:07:42Z")

</div>

Hi all,  
My current cluster is an upgraded cluster from version 7.x to 8.x  
It has alot of system indices that nolonger require in the cluster but whenever i tried to delete it. I got this message

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "security_exception",
        "reason": "action [indices:admin/delete] is unauthorized for user [elastic] with effective roles [superuser] on restricted indices [.kibana_8.6.2_001], this action is granted by the index privileges [delete_index,manage,all]"
      }
    ],
    "type": "security_exception",
    "reason": "action [indices:admin/delete] is unauthorized for user [elastic] with effective roles [superuser] on restricted indices [.kibana_8.6.2_001], this action is granted by the index privileges [delete_index,manage,all]"
  },
  "status": 403
}

```

Is there a way to delete the system indices?  
Thanks for your help.

---

<div class="post-metadata">

**Author:** ![PodarcisMuralis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/podarcismuralis/32/122606_2.png) [@PodarcisMuralis](https://discuss.elastic.co/u/PodarcisMuralis)\
**Post date:** [July 17, 2023, 7:04pm UTC](https://discuss.elastic.co/t/how-to-delete-system-indices/338510/2 "2023-07-17T19:04:43Z")

</div>

System indices are protected against accidental deletions. I think you encounter this problem because your elastic user (superuser) does not have necessary roles.

Please check the user roles if there is explicitly defined delete\_index role.

If you customized your superuser, consider using built-in user.

Or your can try another user.

---

<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:** [July 17, 2023, 11:34pm UTC](https://discuss.elastic.co/t/how-to-delete-system-indices/338510/3 "2023-07-17T23:34:40Z")

</div>

You have to create a new role and add this to the role and add this role to a user.

`"allow_restricted_indices" : 'true"`

The setting is specifically set default to `false` so that even as the ,`elastic` user, you can't accidentally delete system indices.

But now be careful because you can completely destroy your cluster 🙂 if you delete the wrong indices

---

<div class="post-metadata">

**Author:** ![lusynda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lusynda/32/53557_2.png) [@lusynda](https://discuss.elastic.co/u/lusynda)\
**Post date:** [July 18, 2023, 1:37am UTC](https://discuss.elastic.co/t/how-to-delete-system-indices/338510/4 "2023-07-18T01:37:09Z")

</div>

OK after i set the `"allow_restricted_indices" : 'true"` i was able to delete the system indices  
Thanks.

I only gonna delete the reporting indices since i'am nolonger using it.

---

<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:** [August 15, 2023, 1:37am UTC](https://discuss.elastic.co/t/how-to-delete-system-indices/338510/5 "2023-08-15T01:37:52Z")

</div>

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