Scrivio Interview library
DesignAdvanced5 min read · updated 12 November 2026

Several teams run their own Elasticsearch clusters for search features, with high cost and frequent incidents. Design a shared search platform.

We offer search as a managed platform: shared clusters where each team gets its own indices under a prefix, and dedicated clusters only for large or sensitive workloads. Teams use a standard indexing pipeline, events or CDC into a Spring Boot indexer library with bulk writes, versioning and alias-based reindexing, and the platform enforces index templates, mapping reviews, shard sizing and quotas so no team can destabilise a shared cluster. Upgrades, snapshots, security and monitoring are centralised with SLOs for query latency and indexing lag, and we migrate team by team, starting with those with the most incidents and publishing cost per team before and after.

Why this question is asked

When search is useful, every team wants it, and the fastest way to get it is to start a cluster. A few years later the company has a dozen clusters, each sized for a peak it rarely reaches, on different versions, with backups that nobody has tested, and incidents that the owning team struggles to diagnose. A shared platform can cut cost and incidents at the same time, but only if it protects teams from each other. Interviewers ask this to see whether we can design a multi-tenant platform with guardrails and a realistic migration. In this answer, we will look at what goes wrong, define the platform offering, standardise indexing, add guardrails, centralise operations, and plan the migration.

1What Goes Wrong With a Cluster per Team

Each cluster has a fixed overhead: dedicated master nodes, at least two or three data nodes for redundancy, monitoring and backups. A team with 50 GB of data and a few hundred queries per second still pays for a full cluster, so most clusters run at 10 to 20 percent utilisation.

The incidents follow from lack of expertise rather than bad intentions. Common causes are too many small shards, which waste memory and slow the cluster; mappings that create a new field for every key in user data, a mapping explosion; heavy aggregations without limits; old versions with known bugs; and snapshots that were never configured. Every team learns these lessons separately.

2The Platform Offering: Shared by Default, Dedicated When Needed

The platform team runs a few large shared clusters per region and environment. Each team gets indices under its own prefix, such as orders-search-*, with security roles that allow it to read and write only its prefix. Small and medium workloads, which are most of them, live here.

Dedicated clusters are reserved for workloads that are large enough to justify one, or that need stronger isolation: very high query rates, data sizes in the tens of terabytes, or sensitive data with stricter access rules. They are still run by the platform, with the same tooling, so they do not drift back into special cases.

Choosing where a workload runs
WorkloadPlacementWhy
Small or medium indexshared cluster, team prefixlowest cost, platform-managed
Very high query ratededicated clusterprotect shared tenants from load
Sensitive or regulated datadedicated clusterstricter access and audit
Experimentsshared non-production clustercheap, quotas cap the risk

3A Standard Indexing Pipeline

Most search incidents start on the write side: dual writes that drift, single-document writes that overload the cluster, reindexes done by hand. So the platform provides one indexing path. Changes reach Kafka through an outbox or CDC, and a Spring Boot indexer library consumes them. The library handles bulk writes, retries with backoff, external versioning so old events cannot overwrite new ones, a dead-letter topic for bad documents, and alias-based reindexing.

A team only writes the part that is truly theirs: how to turn their events into a document, and the mapping.

Java
public interface DocumentMapper<E> {
String index(); // alias, e.g. "orders-search"
String id(E event);
long version(E event); // from the source, used as an external version
Optional<Object> document(E event); // empty: delete the document
}
// The library supplies bulk batching, retries, versioning, dead letters and reindex tooling.

This also means every team's indexing looks the same to the platform's on-call engineers, which makes incidents much faster to diagnose.

4Guardrails That Keep Shared Clusters Stable

Sharing only works if one tenant cannot hurt the others. Index templates, applied automatically for each team prefix, set safe defaults: a sensible number of shards, one replica, refresh intervals, and dynamic mapping set to strict, so an unexpected field causes an error instead of a mapping explosion. New mappings go through a lightweight review, a check of field counts, types and analysers, before they reach production.

Shard sizing guidance keeps shards in a healthy range, commonly tens of gigabytes each; check your engine version's recommendations. Quotas per team cap the number of shards, total storage and indexing rate, and query limits such as timeouts and a maximum number of aggregation buckets stop a single expensive query from consuming the cluster.

Step throughGuardrails on a shared cluster
  1. Team quotasshards, storage, indexing rate per prefix
  2. Query limitstimeouts, max buckets, result window
  3. Index templatesshards, replicas, strict dynamic mapping
  4. Mapping reviewfields, types, analysers before production
  5. Security roleseach team reads and writes only its prefix

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

5Centralised Operations and SLOs

The platform team owns what each team did badly alone: version upgrades on a regular schedule, snapshots to object storage with tested restores, security with TLS and role-based access, and monitoring of cluster health, heap, disk and slow queries.

We publish SLOs, service level objectives, so teams know what they get: for example, 99th percentile query latency under 200 ms for templated queries, indexing lag under 30 seconds through the standard pipeline, and a monthly availability target. Per-team dashboards show their own latency, lag, storage and quota usage.

6Migrating Team by Team

We do not ask everyone to move at once. We start with the teams that have the most incidents, because they gain most and become the best advocates. For each team, the platform helps set up the indexer library, creates their indices from templates, runs the first reindex into the shared cluster, and switches their alias, after which the old cluster is retired.

We publish cost per team before and after: the old cluster's monthly cost against their share of the shared platform. Seeing a team go from 6,000 dollars a month to 900, with fewer incidents, does more for adoption than any mandate.

7Follow-up questions

How do you charge teams for a shared cluster?

By their share of resources, typically storage and shards plus indexing and query volume, shown monthly. Even if no money moves between budgets, showing the cost changes behaviour and justifies quotas.

What if a team insists on its own cluster?

We ask which requirement the shared platform cannot meet, such as isolation, scale or data sensitivity. If there is a real one, we give them a dedicated cluster run by the platform; if not, the cost comparison usually settles it.

How do you upgrade a shared cluster without breaking teams?

With a published upgrade calendar, a non-production cluster upgraded first where teams run their tests, and rolling upgrades in production. The standard library and templated queries make compatibility much easier to check.

8Conclusion

In this answer, we replaced a cluster per team with a managed platform: shared clusters with per-team prefixes and dedicated clusters only for large or sensitive workloads, one indexing library with bulk writes, versioning and alias-based reindexing, guardrails through templates, mapping reviews, shard sizing and quotas, centralised upgrades, snapshots, security and monitoring with SLOs, and a migration that starts with the teams in most pain and shows cost before and after.

What to say in the interviewAbout 70 seconds aloud

Open with

I would build a managed search platform rather than a policy. By default, teams get indices under their own prefix on shared clusters, with roles so they can only touch their prefix; dedicated clusters exist only for very large, very busy or sensitive workloads, and the platform runs those too.

Then, if they want more

Most incidents start on the write side, so I would provide one indexing path: events from an outbox or CDC into a Spring Boot indexer library that does bulk writes, retries, external versioning, dead letters and alias-based reindexing, where teams only write the mapper from their event to a document.

To keep shared clusters stable, index templates enforce shard counts and strict dynamic mapping, new mappings get a quick review, shard sizing follows guidance, and each team has quotas on shards, storage and indexing rate, plus query timeouts and bucket limits.

The platform team owns upgrades, snapshots with tested restores, security and monitoring, and publishes SLOs for query latency and indexing lag. Then I would migrate team by team, starting with those with the most incidents, and publish each team's cost before and after.

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 official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
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 "Several teams run their own Elasticsearch clusters for search features, with high cost...": https://scrivio-interview-library.netlify.app/architecture/backend-system-design/a0991bd91c/