# How can we search the security index?

**URL:** <https://forum.opensearch.org/t/how-can-we-search-the-security-index/12377>\
**Category:** Security\
**Created:** [February 5, 2023, 7:17am UTC](https://forum.opensearch.org/t/how-can-we-search-the-security-index/12377 "2023-02-05T07:17:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![asfoorial](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@asfoorial](https://forum.opensearch.org/u/asfoorial)\
**Post date:** [February 5, 2023, 7:17am UTC](https://forum.opensearch.org/t/how-can-we-search-the-security-index/12377/1 "2023-02-05T07:17:40Z")

</div>

Hi all,

I was wondering if it is possible to search the security index? Currently the security APIs only list the roles but does not offer full text search over them. This makes it difficult to find roles if the list of roles are, say a million roles.

Thanks

---

<div class="post-metadata">

**Author:** ![kris](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/kris/32/2208_2.png) [@kris](https://forum.opensearch.org/u/kris)\
**Post date:** [February 9, 2023, 11:23pm UTC](https://forum.opensearch.org/t/how-can-we-search-the-security-index/12377/2 "2023-02-09T23:23:43Z")

</div>

I wonder if the answer provided here helps:

> [@Search content of .opendistro\_security index](https://forum.opensearch.org/t/search-content-of-opendistro-security-index/3568/2):
>
> @asfoorial I dont think there is any clean way of achieving this. Using The API will provide the full list of roles as you mentioned, which can then be used in a script to extract necessary roles. It is also possible to query security index . opendistro\_security using curl with admin certs, however the source of the response will be base64 encoded. There might be a plugin available to decode this on the fly and query inside, but I’m not familiar with one.

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [February 9, 2023, 11:56pm UTC](https://forum.opensearch.org/t/how-can-we-search-the-security-index/12377/3 "2023-02-09T23:56:42Z")

</div>

@asfoorial What is the use case?

You could also try the `jq` tool.

```auto
curl --insecure -u admin:admin -XGET https://localhost:9200/_plugins/_security/api/roles?pretty|jq '.readall'

```

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/8/80cc60391f3e771d875a1e0aacf89fee01e3d8e2.png)

---

<div class="post-metadata">

**Author:** ![asfoorial](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@asfoorial](https://forum.opensearch.org/u/asfoorial)\
**Post date:** [February 10, 2023, 6:20am UTC](https://forum.opensearch.org/t/how-can-we-search-the-security-index/12377/4 "2023-02-10T06:20:15Z")

</div>

I want full text search against roles and the users inside them. Is there an easy way to do it?

To be more specific, I want to count the users whose role name starts with a specific prefix. I also want to list roles that contain users with names containing specific string.
