# Query to find all the users with one role

**URL:** https://discuss.elastic.co/t/query-to-find-all-the-users-with-one-role/328156
**Category:** Elasticsearch
**Tags:** elastic-stack-security
**Created:** [March 21, 2023, 10:41am UTC](https://discuss.elastic.co/t/query-to-find-all-the-users-with-one-role/328156 "2023-03-21T10:41:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vaibhav.ubale](https://avatars.discourse-cdn.com/v4/letter/v/e9a140/32.png) [@vaibhav.ubale](https://discuss.elastic.co/u/vaibhav.ubale)
#### Post date: [March 21, 2023, 10:41am UTC](https://discuss.elastic.co/t/query-to-find-all-the-users-with-one-role/328156/1 "2023-03-21T10:41:05Z")

</div>

Hi Team,

How can I find the user in ELK with one particular role.

I can get all the users with following query:

```auto
GET /_security/user

```

but when I try to find user with a role

```auto
GET /_security/user/
{
  "query":"select full_name, where roles == kibana_system"
}

```

I am getting following error:

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "request [GET /_security/user/] does not support having a body"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "request [GET /_security/user/] does not support having a body"
  },
  "status" : 400
}

```

Can some one help me here?  
Thanks in advance

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [March 22, 2023, 4:09am UTC](https://discuss.elastic.co/t/query-to-find-all-the-users-with-one-role/328156/2 "2023-03-22T04:09:14Z")

</div>

`_security` is an API endpoint, which you can tell by the use of the `_` prefix.

Try `GET .security/_search` instead, as that is the index that you are actually wanting the data from.

---

<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: [April 19, 2023, 4:10am UTC](https://discuss.elastic.co/t/query-to-find-all-the-users-with-one-role/328156/3 "2023-04-19T04:10:10Z")

</div>

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