How to Configure Elasticsearch Read Only User

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an elasticsearch read only user by making a custom role with read rights. Then you map that role to a specific user account or API key. Most engineering teams start by sharing one broad admin account during early builds. That shortcut puts live search data at risk when someone runs a bad delete request. A dedicated read account stops accidental writes, drops, and index changes right away. How to set up an elasticsearch read only user Elasticsearch uses role-based rules to control w

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 an elasticsearch read only user by making a custom role with read rights. Then you map that role to a specific user account or API key. Most engineering teams start by sharing one broad admin account during early builds. That shortcut puts live search data at risk when someone runs a bad delete request. A dedicated read account stops accidental writes, drops, and index changes right away.

How to set up an elasticsearch read only user

Elasticsearch uses role-based rules to control what accounts can do inside a cluster. First, you turn on the built-in security features in your cluster settings. Next, you create a new role that defines both cluster and index permissions.

At the cluster level, a read role only needs basic monitor or health check rights. It should never get admin rights that change cluster settings or manage nodes. At the index level, you pick which data streams or indices the role can read. You can match specific index names or use patterns to cover related log groups.

Inside those index rules, you grant only the read and view index metadata rights. This lets the user run search queries and aggregations without changing any documents. Finally, you create the user account and attach it to your new read role. When the user logs in, the cluster checks the role before running any search.

Where native index roles work well and where they fall short

Native roles are great at stopping write calls, index drops, and mapping updates. They draw a hard line between apps that ingest data and engineers who search it. You can also scope roles down to single index patterns for different product teams.

Still, static read roles only check who logs in and which index they touch. Once a user has read rights on an index, they can pull every field. Production logs and search documents often hold sensitive user records mixed with standard app events. A basic read role will still return emails, phone numbers, and card numbers in results. Native document and field security exist, but they often require higher license tiers. They also force teams to maintain complex role rules for every new index schema.

Read-Only Root Filesystem + User Provisioning (SCIM): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing shared credentials and audit trails for search users

Setting up the role is only the first step in keeping search data safe. Teams still have to pass passwords or API keys to engineers and support staff. Shared read passwords often end up in local text files or team chat rooms. When ten people use the same read account, cluster audit logs lose their value. You can see that the read account ran a massive query, but not who did it.

Also, native read roles do not stop someone from running heavy queries that crash nodes. An engineer can still run a broad wildcard search across terabytes of old logs. Managing separate accounts for every single person across many clusters takes hours of manual work. When someone leaves the team, admins must remember to delete their account on every cluster.

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

Can a read only user still slow down an Elasticsearch cluster?

Yes, a read role only blocks write requests and cluster changes. A user can still run heavy searches or deep aggregations that use up memory.

Do I need a separate role for Kibana dashboard users?

Yes, Kibana users need special dashboard rules Also, to basic index read rights. This lets them open visual boards without changing saved objects or cluster settings.

How do I stop read users from seeing sensitive fields in search results?

Native roles return the full document unless you set up field-level rules or data masking. Data masking rewrites matched fields like emails or national IDs before results reach the user.

The query runs. The emails stay hidden.