BlueShop Search & Elasticsearch — As Built

What this showcase explains: shoppers can refine, revisit and understand search results while Catalog keeps Elasticsearch synchronized as a rebuildable read model, not a transactional source of truth.

1. What Search Delivers

Search connects customer intent to current sellable Catalog facts without moving product ownership into Elasticsearch.

Customer experienceFind, refine and return.

Multilingual text, exact identifiers, typed facets, sorting and URL state make discovery understandable and repeatable.

Operational continuityCommitted changes reach the index durably.

Product and Stock facts become coalesced work; the worker rehydrates current Catalog state before upsert or removal.

Practical example: publishing makes a product searchable, renaming changes what query finds it, selling out can hide it, receiving stock can restore it, and archiving removes it without a shopper or manager running a reindex.

2. Refine, Sort, Reload

A shopper narrows a real category and returns to the same search state after browser reload.

FACETS + URL STATE / 2M 16.52S

Refine, Sort, Reload

Matter compatibility, AeroClean brand, battery power, free text and price order reduce the list while result and facet counts stay useful. Reload restores the complete state from the URL.

3. Product Lifecycle Changes Search

INDEX LIFECYCLE / 1M 28.92S

Publish, Rename, Archive

The Aurora field camera is absent before publication, appears when published, answers to its new localized name after an edit and disappears after archival. No manual reindex appears in the journey.

4. Availability Changes Search Visibility

STOCK PROJECTION / 43.36S

Hide Sold Out; Restore on Receipt

The Astra wireless headset starts with six units, leaves storefront search after a warehouse write-off and returns after a receipt adds twelve. Stock remains the authority throughout.

5. One Product, Many Ways to Find It

RELEVANCE + IDENTIFIERS / 1M 12.64S

Names, Languages, SKU and EAN

A rare exact-name match outranks a description-only match. French, German and Italian names plus exact SKU and EAN searches resolve the same stable product identity.

6. Business Result

TECHNICAL DEEP DIVE

How storefront search works

Catalog owns both query semantics and projection orchestration. Elasticsearch serves bounded reads through aliases and never participates in transactional Catalog writes.

7. Ownership Dependencies

There is no deployed Search microservice. Search is a Catalog-owned read capability with Stock-projected availability.

Storefront calls Catalog search, Catalog reads Elasticsearch, PostgreSQL owns Catalog state and Kafka carries Stock and product facts into durable index work
Storefront owns URL/search state. Catalog owns query semantics, facets, document shape and indexing work. PostgreSQL and Stock remain authoritative; Elasticsearch is the read model.

8. Read Path, Relevance and Facets

The public search endpoint builds a bounded Elasticsearch query from URL-backed storefront state.

Storefront URL state flows through Catalog query builder into Elasticsearch and returns products facets totals and pagination
Default page size is 24, maximum is 100, and product ID provides deterministic secondary sorting. Default ordering uses relevance; explicit sorts include price, newest and English name.
Indexed relevance areaCurrent boostPurpose
Curated product search terms40Strongest merchandising intent
Category path names / terms8 / 6Category context
SKU and EAN5Exact operational identifiers
Product names DE/FR/IT/EN4Localized discovery
Description and searchable attribute text1Broad supporting text
Facet behavior: the query separates the main query, post-filter and per-facet aggregations so alternatives remain countable while other constraints stay active. Attribute filters respect ENUM, numeric, boolean and localized-text types.

9. Durable Product Indexing

Product events do not write Elasticsearch directly. They record durable PostgreSQL work keyed by product ID; repeated work coalesces before the worker reads current state.

Committed Catalog event records coalesced PostgreSQL index work, worker reloads current product state and upserts or deletes through the write alias
Rehydrating current state prevents an old event payload from replacing a newer product. Successful work disappears; failed work remains retryable with bounded backoff.

10. Stock-Driven Visibility

Stock events update Catalog’s availability projection and enqueue the same durable product-index work.

Stock availability event updates Catalog projection, queues current product reindexing and changes storefront visibility through Elasticsearch
Unknown stock state stays visible by design. A product-level availability row decides the product; when only variants exist, the product becomes out of stock only when every known variant is out of stock.

11. Recovery, Documents and Aliases

The full rebuild scans published products from Catalog, hydrates current metadata and availability, upserts documents, then removes stale IDs.

Full reindex recreates aliases if needed, scans published products in pages, hydrates current state, upserts concurrently and purges stale Elasticsearch documents
Read and write aliases isolate callers from the concrete catalog-products-v1 index. The current code provides a future migration seam but does not implement blue-green alias rotation.
Document areaIndexed facts
IdentityProduct ID, SKU, EAN, slug and lifecycle status
MerchandisingThumbnail, brand, tax-inclusive price and creation time
CategoryLeaf category, full path IDs, localized names and curated terms
Search textCurated terms plus localized name and description
AttributesNested code/type with enum, numeric, boolean or localized text values
AvailabilityCatalog’s projected inStock value

12. Explicit Limits

No Search serviceThe capability remains inside Catalog; this page does not invent a separate bounded context.
No fuzzy correctionThe current query uses analyzed multilingual matching, not automatic spelling correction.
No Elasticsearch write authorityCatalog operational writes never depend on Elasticsearch success.
Unknown Stock is fail-openMissing projection data does not hide an otherwise published product.
No blue-green rotationAliases exist, but automated versioned-index cutover is not delivered.
Development topologyThe current single-node Elasticsearch deployment is not a multi-node HA claim.