# Elasticsearch put role API

**URL:** <https://discuss.elastic.co/t/elasticsearch-put-role-api/239428>\
**Category:** Elasticsearch\
**Created:** [July 1, 2020, 7:44am UTC](https://discuss.elastic.co/t/elasticsearch-put-role-api/239428 "2020-07-01T07:44:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hari\_Prasanth\_Logana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hari_prasanth_logana/32/71438_2.png) [@Hari\_Prasanth\_Logana](https://discuss.elastic.co/u/Hari_Prasanth_Logana)\
**Post date:** [July 1, 2020, 7:44am UTC](https://discuss.elastic.co/t/elasticsearch-put-role-api/239428/1 "2020-07-01T07:44:15Z")

</div>

I started using the create role API and it works as expected: [https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html)

I got the list of default roles in elastic search, `/_security/role` but I don't know to create the following roles and not able to find the proper docs for it.

I want to segregate the user based on the following needs,

1. Role which has the privilege to perform only READ / WRITE in all the indices in Elastic Search (This role should not have privilege to CREATE / DELETE indices
2. Role which has the privilege to perform only operations on Kibana
3. Role which has the privilege to perform only operations on Logstash

Thanks,  
Harry

---

<div class="post-metadata">

**Author:** ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)\
**Post date:** [July 22, 2020, 3:47am UTC](https://discuss.elastic.co/t/elasticsearch-put-role-api/239428/2 "2020-07-22T03:47:20Z")

</div>

For your first role creation, try the following

```auto
POST /_security/role/my_admin_role
{
  "cluster": ["all"],
    "indices" : [
      {
        "names" : [
          "*"
        ],
        "privileges" : [
          "read",
          "write"
        ],
        "field_security" : {
          "grant" : [
            "*"
          ],
          "except" : []
        },
        "allow_restricted_indices" : false
      }
    ],
    "applications" : [],
    "run_as" : [],
    "metadata" : { },
    "transient_metadata" : {
      "enabled" : true
    }
}

```

---

<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 19, 2020, 3:47am UTC](https://discuss.elastic.co/t/elasticsearch-put-role-api/239428/3 "2020-08-19T03:47:24Z")

</div>

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