Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Zalando Engineering 20 min read Case study mediumAdept

Migrating From Elasticsearch 7.17 to Elasticsearch 8.x: Pitfalls and Learnings

Zalando's Search & Browse team moved their multi-cluster Elasticsearch deployment from 7.17 to 8.x, mainly to get approximate kNN vector search. They chose the official Elasticsearch Java API client over the community Scala client because it is officially maintained and has a kNN DSL. They first ran the old High Level REST Client in compatibility mode and used Testcontainers tests covering old/new client and cluster combinations. Those tests surfaced breaking changes they had to fix: the removed _type field, null is_write on aliases, date range bounds that had to be strings, action.destructive_requires_name now defaulting to true, and a mandatory nested.path on nested sorts. Cluster settings were also reworked, including node.roles, removal of deprecated thread pool and transport settings, and GC flags.

Related posts

  • Failing to Auto Scale Elasticsearch in Kubernetes

    Zalando Engineering mediumAdept

    A schedule-driven Elasticsearch cluster run by es-operator on Kubernetes repeatedly failed to scale out for the morning peak. A drain retry loop ignored context cancellation, so a nightly scale-in got stuck on the last node in an availability zone because zone awareness blocked shard relocation. After a Kubernetes 1.28 upgrade reshuffled pods on ephemeral storage, a second bug surfaced: interrupted scale-ins never removed the node from cluster.routing.allocation.exclude._ip, leaving 'zombie' excluded nodes. Mitigations were raising the nightly node count, manually clearing the exclusion list and fixing a forgotten cronjob. Crash-safe cleanup remains an open problem, and the lesson drawn is to read the code.

  • Managing Elasticsearch Reindex at Scale: Performance, Reliability, and Observability

    Palantir mediumAdept

    Palantir's Gotham document store rebuilds Elasticsearch indices from its transactional database (the source of truth) rather than using Elasticsearch's _reindex API, so search keeps serving live traffic throughout. The design writes to both the primary index and a shadow index, swaps them using aliases, and resolves conflicting writes with external_gte versioning. A background loop compares persisted metadata against actual cluster state and queues repairs. Later improvements added a parallel paging and indexing job runner with resumable checkpoints, three-way batch limits (document count, memory, batches per run), crash-safe idempotent state machines for index lifecycle operations, and layered logs, metrics and diagnostics for observability.

  • GitHub Issues search now supports nested queries and boolean operators: Here’s how we (re)built it

    GitHub Engineering mediumAdept

    GitHub rebuilt Issues search to support AND/OR operators and nested parentheses by replacing the flat-list parser with a PEG grammar (via the Ruby parslet library) that produces an abstract syntax tree. That tree is recursively traversed into nested Elasticsearch bool queries, with AND and OR mapped to must and should clauses. To protect backward compatibility at roughly 2,000 QPS, the team reran the existing test suites with the feature flag on and off and dark-shipped 1% of searches through both systems using the scientist library, comparing result counts and performance. The rollout capped nesting at five levels and started with the GraphQL API and the repository Issues tab before expanding to the dashboard and REST API.

  • Contentsquare Migration from Elasticsearch to ClickHouse

    ClickHouse mediumAdept

    Contentsquare replaced 14 Elasticsearch clusters with ClickHouse over a phased migration. They first built a new product on ClickHouse, then shadowed production queries endpoint by endpoint to compare results, then moved customers one at a time over six months with zero regressions. The result was 11x lower infrastructure cost, 10x better p99 latency, and longer query windows and retention. Key design pieces were a Kafka-fed ingestion service (clickin) that writes shard-aligned data in ClickHouse native format via clickhouse-local, and an AST-based query optimizer that propagates partition/sort-key conditions and distributed_group_by_no_merge, merges subqueries, and gave a 10x speedup on the slowest 5% of queries.

  • 100x Faster: GraphQL Hive migration from Elasticsearch to ClickHouse

    ClickHouse easyNovice

    GraphQL Hive replaced Elasticsearch with ClickHouse for storing per-request GraphQL monitoring data (consumer, requested fields, latency, request body) after query latency degraded with data growth and one large tenant slowed queries for smaller ones. On a 20M-row benchmark where one user owned half the rows, percentile queries took ~10s on Elasticsearch, ~5s on InfluxDB (which struggled with high cardinality), ~3s on TimescaleDB and ~100ms on ClickHouse. Druid was skipped as too complex. Because data had a 30-day TTL, the team dual-wrote to both stores for a month and then switched reads with zero downtime, reporting a 100x average improvement and growth from millions to billions of rows per month. They are now moving to ClickHouse Cloud for sharding and replication.

The quest for software engineering knowledge.

Look:
Layout: