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.
February 9, 2023, 11:23pm
I wonder if the answer provided here helps:
@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.
February 9, 2023, 11:56pm
@asfoorial What is the use case?
You could also try the
curl --insecure -u admin:admin -XGET https://localhost:9200/_plugins/_security/api/roles?pretty|jq '.readall'
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.