Medium zalando search

A relevant product ranks too low or does not appear. How do you debug it?

The 30 second answer

First I separate matching from ranking. If the product does not match, I check analysis with the analyze API, the mapping, and any filters or redirects that excluded it. If it matches but ranks low, I read the explain output to see which clauses, field weights and term statistics produced the score, then look at boosts and later ranking stages. I fix the cause and add the query to a judgment set.

Step 1: does it match at all? Run the query restricted to that product's ID.

  • If it does not match, compare the tokens: run _analyze on the product's title and on the query with the field's analyzers. Stemming, a missing synonym, a decompounding gap or a keyword field used for text are common causes.
  • Check the mapping: is the field indexed, and is the value in the field you query?
  • Check filters: an availability filter, a market filter or an entity wrongly turned into a filter, such as a colour recognised from an ambiguous word, can exclude it silently.
  • Check freshness: if the product was just updated, a refresh may not have happened yet.

Step 2: why is the score low? The Explain API returns how a specific document's score was computed: which clauses matched, the BM25 parts for each term, and boosts. Typical findings: the term matched only a low-weight field; a common term with low IDF; scores from many fields combined in a way that rewards one field over another.

Step 3: later stages. In e-commerce the text score is only the first stage. Re-ranking, personalisation, sponsored placement and business rules can move the product. Check each stage's output for that query; Zalando's public architecture has several such stages above Elasticsearch.

Step 4: fix and protect. Change the analyzer, mapping, field weights or query shape, not k1 and b, which are rarely the cause. Then add the query and its expected results to an offline judgment set, so the fix is measured with NDCG or recall and protected against regressions. See How do you evaluate whether search relevance actually improved?.

Sources (5)
  1. Elasticsearch API: Explain a document match result
  2. Elasticsearch docs: Anatomy of an analyzer
  3. Lucene 9.11 BM25Similarity Javadoc (defaults and IDF formula)
  4. Zalando Engineering: The Day Our Own Queries DoS'ed Us: Inside Zalando Search (December 2025)
  5. MICES 2026: Zalando Search: Architecture Behind Product Discovery (video)