HeadlinesBriefing favicon HeadlinesBriefing.com

Instacart swaps Elasticsearch for Postgres, adds AI vector search

ByteByteGo •
×

In 2021 Instacart’s search team wrestled with two opposite shopper intents: precise SKU queries like “pesto pasta sauce 8oz” and vague health‑focused searches such as “healthy foods.” Keyword matching satisfied the former, while semantic understanding was required for the latter, requiring parallel retrieval pipelines. The catalog spans billions of SKUs across thousands of retailers, and query volume spikes hourly, demanding millisecond latency.

Originally built on Elasticsearch, the system suffered because each field change forced a full document re‑index. With billions of daily price, inventory and discount updates, indexing lag grew to days. The team migrated the search layer to Postgres, leveraging GIN indexes and ts_rank, which sliced write load by tenfold and allowed separate tables for pricing, availability and ML features.

To cover ambiguous queries, Instacart introduced a semantic branch powered by vector embeddings and FAISS for approximate nearest‑neighbor lookup. Each query now triggers simultaneous calls to Postgres for keyword hits and to the FAISS service for meaning‑based results, which are merged into a single ranked list. This hybrid architecture delivers fast, up‑to‑date results across a catalog of billions of products.