# How to remove a user from role mapping

**URL:** <https://discuss.elastic.co/t/how-to-remove-a-user-from-role-mapping/339688>\
**Category:** Elasticsearch\
**Created:** [July 31, 2023, 12:08pm UTC](https://discuss.elastic.co/t/how-to-remove-a-user-from-role-mapping/339688 "2023-07-31T12:08:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)\
**Post date:** [July 31, 2023, 12:08pm UTC](https://discuss.elastic.co/t/how-to-remove-a-user-from-role-mapping/339688/1 "2023-07-31T12:08:32Z")

</div>

HI Team,  
we are using ELK version 7.17.10 and we have created Roles to manage our indices.

my question is if want to remove user from role mapping how do i perform by using Delete command.

Looking forward your input.

NOTE: Currently we are adding/removing the user manually in role mapping and we need to automate.

---

<div class="post-metadata">

**Author:** ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)\
**Post date:** [August 1, 2023, 5:02am UTC](https://discuss.elastic.co/t/how-to-remove-a-user-from-role-mapping/339688/2 "2023-08-01T05:02:07Z")

</div>

Can anyone help me on this. its very urgent requirement

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 1, 2023, 7:51am UTC](https://discuss.elastic.co/t/how-to-remove-a-user-from-role-mapping/339688/3 "2023-08-01T07:51:21Z")

</div>

Please be patient in waiting for responses to your question and refrain from pinging multiple times asking for a response or opening multiple topics for the same question. This is a community forum, it may take time for someone to reply to your question. For more information please refer to the [Community Code of Conduct](https://www.elastic.co/community/codeofconduct) specifically the section "Be patient". Also, please refrain from pinging folks directly, this is a forum and anyone that participates might be able to assist you.

If you are in need of a service with an SLA that covers response times for questions then you may want to consider talking to us about a [subscription](https://www.elastic.co/subscriptions).

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

---

<div class="post-metadata">

**Author:** ![sholzhauer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sholzhauer/32/110282_2.png) [@sholzhauer](https://discuss.elastic.co/u/sholzhauer)\
**Post date:** [August 1, 2023, 8:59am UTC](https://discuss.elastic.co/t/how-to-remove-a-user-from-role-mapping/339688/4 "2023-08-01T08:59:17Z")

</div>

I don't believe you can use a `DELETE` call to remove a user from a role mapping.  
As I am not 100% sure on your approach the following could help you;

1. You make use of role mappings to define which roles a user gets and have multiple users listed in the mapping.

2. You add roles directy to a local user.

**In the first scenario** you can use two api calls to remove the required user: first you [get the current implementation](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-api-get-role-mapping.html) which you mutate by removing the desired user(s) and then you [update the role mapping](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-api-put-role-mapping.html) with the new definition.

**In the second scenario** you follow the same approach by [retrieving](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-api-get-user.html) and [updating](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-api-put-user.html) but now on the user itself.

---

<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 29, 2023, 8:59am UTC](https://discuss.elastic.co/t/how-to-remove-a-user-from-role-mapping/339688/5 "2023-08-29T08:59:56Z")

</div>

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