How to Configure Opensearch User Roles
You set up opensearch user roles by creating permission sets in the security plugin. Then you map those sets to users or external groups. Most teams start by linking their identity provider to the cluster. They often assign broad read or write roles to keep projects moving fast. When roles are too broad, one bad query can expose private data or delete indexes. How opensearch user roles work in the cluster The security plugin controls what every person and app can do inside the cluster. It bre
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up opensearch user roles by creating permission sets in the security plugin. Then you map those sets to users or external groups. Most teams start by linking their identity provider to the cluster. They often assign broad read or write roles to keep projects moving fast. When roles are too broad, one bad query can expose private data or delete indexes.
How opensearch user roles work in the cluster
The security plugin controls what every person and app can do inside the cluster. It breaks access down into three core parts. First, you define action groups that list allowed API calls like read or write. Second, you build a role that ties those actions to specific index patterns. Third, you create a role mapping that connects the role to a user.
You can map roles directly to internal users stored inside the cluster database. Most engineering teams map roles to backend roles from an external identity provider instead. When a user logs in, the identity provider sends a token with group claims. The cluster reads those claims and matches them to the right role mapping. This lets you manage team changes in one central directory.
Inside each role, you divide permissions between cluster actions and index actions. Cluster permissions cover wide tasks like checking node health or managing snapshots. Index permissions control who can read, write, or delete data in named indexes. You can also add document and field rules inside a single index role. These rules filter out specific documents or hide named fields from the search output.
Setting up fine-grained rules for documents and fields
Index roles alone are often too blunt for shared logs or customer data. Two teams might query the same index while needing different views of the data. Document level security lets you write a query filter inside the role itself. When a user runs a search, the cluster runs that filter first. The user only gets documents that match the role rule.
Field level security goes one step further inside each matched document. You can list which fields a role is allowed to include or exclude. You can also apply native field masking to hash or replace string values. This works well when you know the exact schema of every single index. If a new log source changes field names, the static rule will miss it.
User Provisioning (SCIM) + Lambda Execution Roles: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native roles solve and what they miss
Native roles do a great job of separating apps and broad team duties. You can lock ingestion pipelines to write roles and dashboards to read roles. This stops a simple dashboard user from dropping an entire production index by mistake. It also gives auditors a clear list of who holds cluster admin rights.
Still, static roles only check who logs in and which index they touch. They do not inspect the content of free-form search queries or scripts in flight. When an engineer troubleshoots an outage, they often need a wide read role. That role lets them query raw app logs across dozens of shared indexes.
Raw logs often contain unindexed text strings with emails, phone numbers, or card numbers. Because these values sit inside free-text message fields, native field rules miss them. Dynamic data masking solves this by rewriting matched fields in results before they leave. Also, static roles remain active all day instead of expiring after one fix. Teams still need a way to approve risky actions and audit exact queries.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev sits inline in the wire protocol beside those services as an open-source proxy, a sidecar for your Postgres or API. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
What is the difference between users and backend roles in OpenSearch?
A user is an individual login account stored in the cluster or an external directory. A backend role is a group label sent by your identity provider during login. Mapping permissions to backend roles lets you grant access to whole teams at once.
Can one user hold multiple opensearch user roles at the same time?
Yes, a user receives all roles that match their username or their backend roles. The cluster combines the allowed actions from every matched role during a request. If one role grants read access and another grants write access, the user gets both.
Why do field security rules miss sensitive data in log messages?
Native field rules work on fixed JSON keys defined in your index mapping. Log messages often dump emails, card numbers, or national IDs into one unstructured text field. Hiding the whole message field breaks debugging, while leaving it open exposes that raw data.
Related guides
In this post