Scrivio Interview library
DesignPrincipal6 min read · updated 12 November 2026

Your search clusters have grown to petabytes over a decade, mostly logs, and cost is rising faster than revenue. What long-term architecture and policy decisions would you make?

I would first separate log analytics from product search, because they have different access patterns and cost models and should not share clusters or rules. For logs, I would move data through hot, warm, cold and frozen tiers, with searchable snapshots on object storage for older data, set retention per data set by its value and by regulation, and sample or aggregate low-value logs before they are stored. I would evaluate cheaper columnar or object-storage-based log engines for the bulk of logs, and charge the cost back to the teams that produce the logs so they see the price of verbose logging.

Why this question is asked

A search cluster that grew for a decade usually stores everything at the same cost: every debug line from every service sits on the same fast disks as the product catalogue, for as long as anyone ever asked. The bill grows with the amount of data written, not with the value anyone gets from it. Interviewers ask this question at principal level to see whether we can change the economics with architecture and policy, not just tune the cluster. In this answer, we will separate the workloads, design storage tiers, set retention and reduction policies, consider other engines for logs, and use chargeback to keep the result from drifting back.

1Separate Log Analytics From Product Search

Product search and log analytics look alike because both use the same engine, but they behave very differently. Product search holds a modest, valuable data set, perhaps hundreds of gigabytes, that is queried thousands of times a second with strict latency targets and relevance tuning. Logs are huge, written constantly, mostly append-only, and the vast majority are never read; when they are, it is by an engineer during an incident, who can wait several seconds.

Keeping them in the same clusters means the logs force expensive hardware decisions and noisy operations onto the search workload, and search's latency requirements force expensive hardware onto the logs. So the first decision is structural: product search gets its own clusters, sized for latency and owned with the product, and logs move to a separate platform whose sole goal is cost per useful query.

2Tier the Log Data by Age

Logs lose value quickly. Most queries look at the last day or two, a few at the last weeks, and almost none at last year except for audits. A tiered architecture matches storage cost to that curve. The hot tier holds the newest data on fast local SSDs, where it is indexed and queried often. The warm tier holds data a few days old on cheaper, denser nodes, read-only and force-merged. The cold and frozen tiers use searchable snapshots: the index data lives in a snapshot on object storage, such as S3, and the cluster mounts it. In the cold tier the data is fully cached locally, in the frozen tier only the parts a query touches are fetched and cached, so a node can serve far more data than its disks hold.

Object storage typically costs a small fraction of replicated SSD storage per gigabyte, and a snapshot does not need replicas in the cluster because the object store provides durability. Queries on the frozen tier are slower, seconds rather than milliseconds, which is acceptable for old logs. Searchable snapshots are a licensed feature in Elasticsearch and exist in a different form in OpenSearch, so check the licence and version you run.

Step throughLog storage tiers
  1. Hot: local SSD, 1 to 3 daysindexing and most queries, 1 replica
  2. Warm: dense disks, up to 30 daysread-only, force-merged
  3. Cold: searchable snapshot, fully cachedno replica needed, object store is durable
  4. Frozen: searchable snapshot, partly cachedslow queries, very low cost
  5. Delete or archiveby retention policy per data set

5 layers, from the top down. Step through them one at a time.

Lifecycle policies move indices down the tiers automatically.

3Set Retention by Value and Regulation

Tiering lowers the cost per byte; retention lowers the bytes. A decade of growth usually means retention was never decided, so everything is kept. We classify data sets: security and audit logs may have to be kept for a year or more by regulation, application error logs are useful for weeks, and debug and access logs for days. Retention is set per data set with its owner, written in the lifecycle policy, and changed only through review.

Regulation cuts both ways. Some logs must be kept, but logs containing personal data may also have to be deleted within a set time, so keeping everything for ever is a compliance risk as well as a cost.

4Reduce Before Storing: Sampling and Aggregation

The cheapest log is the one we never store. Many logs are repetitive: a health-check line every second from every pod, or one access log line per request for a service doing 50,000 requests a second. We can sample them, keeping for example 1 in 100 successful requests but every error. We can aggregate them into metrics, so instead of storing 4 billion lines a day we store request counts and latency percentiles per endpoint per minute. And we can drop fields nobody queries, which shrinks every document.

These reductions happen in the collection pipeline, for example in the log shipper or a stream processor, before indexing. A 30 to 60 percent drop in daily volume from sampling and field pruning is common in long-lived clusters, and it reduces every tier at once.

5Consider Cheaper Engines for Logs

A full-text inverted index on every field of every log line is expensive to build and store, and many log queries are really filters on a few fields, time ranges and aggregations. Columnar log stores, such as ClickHouse-style databases, compress logs very well and answer aggregations quickly. Object-storage-based engines, such as Loki-style systems that index only a few labels and keep the raw logs compressed in object storage, cost much less per gigabyte, at the price of slower full-text search.

I would run an evaluation rather than a migration first: take two or three large log data sets, replay a month of real queries against a candidate engine, and compare storage cost, query latency and operational effort. If the savings are large, migrate data set by data set, keeping the search engine for the logs that really need rich full-text search.

Where each kind of data belongs
DataAccess patternSuggested home
Product searchhigh QPS, low latency, relevancededicated search cluster
Recent application logsfrequent incident querieshot and warm search tiers
Older logs and auditsrare queries, long retentionsearchable snapshots on object storage
High-volume access logsmostly aggregationssampled, or a columnar log store
Health checks, debug noisealmost never readdrop or turn into metrics

6Make the Cost Visible: Chargeback

Technical fixes drift back unless the people who create the data see its cost. We measure ingested and stored volume per producing team, from index or data stream names or a team field on every log, and publish a monthly cost per team, then charge it back to their budget or at least show it next to their other costs. A team that sees its debug logging costs more than its compute fixes it quickly.

Alongside chargeback, the platform offers defaults that make the cheap path easy: standard lifecycle policies, sampling settings, and a self-service way to request longer retention with a stated reason. That keeps cost growth tied to value rather than to habit.

7Follow-up questions

What about the data already stored for years?

We apply the new retention policies to existing indices, deleting what is past its limit, and move what remains to snapshots on object storage and the frozen tier. Data that must be kept only for audit can live as plain snapshots that are restored on request, which costs least of all.

Will engineers accept slower queries on old data?

Usually yes, if the recent data stays fast and the trade-off is explained with numbers. Incident investigations are almost always about the last hours or days. We should measure which ages queries actually touch before deciding the tier boundaries, and adjust if a team has a real need.

8Conclusion

In this answer, we tackled petabytes of mostly log data by separating product search from log analytics, tiering logs through hot, warm, cold and frozen storage with searchable snapshots on object storage, and setting retention per data set by value and regulation. We reduced volume with sampling, aggregation into metrics and field pruning, evaluated cheaper columnar and object-storage-based log engines, and used chargeback so producing teams see the cost of what they log.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start by splitting the problem, because product search and log analytics have nothing in common except the engine. Product search is small, valuable and latency-critical, so it gets dedicated clusters.

Then, if they want more

Logs are huge, append-only and mostly never read, so they get a platform optimised for cost per useful query.

For logs I would introduce tiers by age through lifecycle policies: a hot SSD tier for the last few days, a warm tier of dense read-only nodes, and cold and frozen tiers built on searchable snapshots in object storage, which costs a fraction of replicated SSD and needs no replicas in the cluster. Then I would cut the bytes.

Retention is set per data set with its owner, by its value and by regulation, which also helps with personal data deletion obligations. In the collection pipeline we sample high-volume logs, for example keeping every error but one in a hundred successful requests, turn repetitive logs into metrics, and drop unused fields.

I would also evaluate cheaper engines, such as a columnar log store or an object-storage-based log system, by replaying real queries against a month of real data, and migrate the data sets where the savings justify it.

Finally I would publish cost per producing team and charge it back, with standard policies as the easy default, so verbose logging has a visible price and the costs do not drift back up.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Elasticsearch documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your search clusters have grown to petabytes over a decade, mostly logs, and cost is...": https://scrivio-interview-library.netlify.app/databases/search-engines/7ecc5f2de7/