# 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:** 1\
**Showing post:** 4

<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.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-remove-a-user-from-role-mapping/339688)._
