How to Configure Elasticsearch Drop Table Protection

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up elasticsearch drop table protection by blocking index deletion in user roles. You also require exact index names instead of wildcards for any delete action. In search clusters, an index holds your data just like a database table. Teams often share broad admin roles so developers can fix bugs fast. When a user runs a bad delete call, those broad roles allow total data loss. How native elasticsearch drop table protection works Search clusters do not use tables or drop statements like

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 elasticsearch drop table protection by blocking index deletion in user roles. You also require exact index names instead of wildcards for any delete action. In search clusters, an index holds your data just like a database table. Teams often share broad admin roles so developers can fix bugs fast. When a user runs a bad delete call, those broad roles allow total data loss.

How native elasticsearch drop table protection works

Search clusters do not use tables or drop statements like relational databases do. Instead, they store JSON documents inside indices and use HTTP requests to manage them. Dropping a table is the same as sending a delete request to an index. You stop this by changing two main settings in your cluster.

First, you update the cluster settings to block wildcards on delete requests. By default, a user can send a delete call with a star symbol. That single call wipes out every index in the cluster at once. Turning off wildcard deletes forces users to type the exact index name every time.

Second, you remove index delete rights from standard human and app roles. You create a read role for daily checks and a write role for apps. Neither role gets permission to delete an index or change index settings. For vital indices, you can also turn on a read-only metadata block. This setting stops index deletion even if a user holds high role rights. A user must remove the block first before they can delete the index.

Where static cluster roles fall short

Native roles and cluster blocks work well for normal apps and daily read tasks. They stop regular users from wiping out an index by mistake. Still, real life in a busy engineering team is rarely that simple. Sooner or later, an on-call engineer needs to fix a broken production index. They might need to update a mapping, clear bad documents, or remove old logs.

Elasticsearch Security + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To do that work, the engineer logs in with an admin role. Once they log in, static roles cannot inspect what each request does in flight. The cluster only checks who logged in when the session starts. It does not check if a delete request targets a test index or production. If the engineer pastes the wrong index name, the cluster deletes the data right away.

Shared admin keys make this problem even worse for security teams. When three engineers share one admin account, the cluster logs show the same user name. You cannot tell who ran the delete call during a late night incident. Static roles also cannot hide sensitive fields inside search results for admins. When an engineer runs a query to check data, raw emails and phone numbers appear. You need a way to check every request and require approval for risky actions.

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 equivalent of a drop table command in a search cluster?

An HTTP delete request sent to an index path acts like a drop table command. It removes the index, all documents inside it, and the index mapping right away.

How do you stop wildcard deletes across all indices?

You enable the cluster setting that requires explicit index names for all delete requests. This setting rejects any delete call that uses a star or all-index keyword.

Can you recover an index after an accidental delete request?

You cannot undo an index delete request once the cluster runs it. The only way to get the data back is to restore from an earlier snapshot.

The query runs. The emails stay hidden.