The Simplest Way to Make Elasticsearch and TimescaleDB Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Running elasticsearch and timescaledb together pairs fast full-text log search with relational time-series storage. Teams use this setup to correlate app logs with system metrics during live production incidents. Each engine solves a distinct data problem. One indexes unstructured text documents for fast keyword filtering. The other stores structured metrics in relational tables optimized for time-based aggregations. When you join them in a single workflow. Engineers can find an error log and c

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.

Running elasticsearch and timescaledb together pairs fast full-text log search with relational time-series storage. Teams use this setup to correlate app logs with system metrics during live production incidents.

Each engine solves a distinct data problem. One indexes unstructured text documents for fast keyword filtering. The other stores structured metrics in relational tables optimized for time-based aggregations. When you join them in a single workflow. Engineers can find an error log and check metric. Spikes from the exact same second.

How data and permissions flow between elasticsearch and timescaledb

In a standard production setup. Ingestion pipelines split incoming telemetry by data type. Log shippers route text events to the search cluster metric collectors write numeric measurements to the relational time-series database both systems rely on aligned timestamps and shared tags like hostnames or service IDs.

Login across both systems requires coordinated identity management. Engineers and visualization dashboards need read grants on both data stores to build unified views. Most teams link both engines to a central identity provider or folder service still, the two platforms handle internal access in very different ways.

The search cluster manages grants at the index and document level using API keys or user roles. The relational database controls grants using standard database roles, schemas, and table grants when a dashboard tool or an engineer queries both systems. Each platform checks keys against its own local role rules.

Common failure modes and how to scope roles

Operating two separate data platforms often leads to security shortcuts. The most common failure mode is the use of shared service accounts. Teams often create one admin account for their dashboard tool and another for engineers to share during outages. When everyone uses the same keys, you lose clear logs.

Broad tokens and over-privileged database roles create another major risk. An ingestion worker only needs write grants for exact indices or metric tables yet admins often grant full read and write grants across the entire cluster to avoid grants errors during setup if an attacker compromises that worker, they can read or delete all historical data.

Unlogged ad-hoc queries also create blind spots during an incident, engineers connect directly to the search API and the SQL interface to run diagnostic queries if they use shared passwords. Internal logs only show that the admin role ran a query you cannot tell which person accessed sensitive customer logs or dropped a metric chunk.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix these issues. Scope roles by workload and human identity. Create dedicated, write-only accounts for data shippers and restrict. Them to exact indices or schemas. Give visualization tools read-only keys scoped only to non-sensitive tables and views. Never reuse ingestion keys for human fixing.

Next, lock down the network paths between your apps and both data stores. Place both databases in private subnets that block public internet traffic. Require all human users and automated services to log in through a central control point. They reach either database port.

Managing human queries and data privacy in production

App logs and system telemetry often contain sensitive customer details. Email addresses, IP addresses. Session tokens frequently leak into error logs or metadata tags. Even if you scope database roles well. An engineer running a broad search query will still see that raw data on their screen.

Securing this workflow requires controls at the query layer. You must tie every search request and SQL command to an single user identity. You also need a way to inspect query results and mask sensitive fields. They reach the user.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Why run both databases instead of picking just one?

Search engines excel at indexing unstructured text. Relational time-series databases handle high-cardinality numeric aggregations with lower storage overhead. Using both lets each engine handle the workload it was built to process.

How do you correlate data between the two systems?

Enforce a consistent tagging schema across all your telemetry pipelines. When both logs and metrics share exact timestamps. Service names, and host IDs. Dashboard tools can query both sources on the same screen.

How should engineers run ad-hoc queries during an outage?

Engineers should log in with their single corporate identities. Shared database passwords. Every query should pass through an access layer that logs the user identity. Records the command, and masks sensitive fields in the results.

Short role checks help teams work fast. Simple rules make each review clear. Good logs keep every team safe. Scoped keys stop bad changes early.

The query runs. The emails stay hidden.