Search projects fail in a specific and predictable way. The engine gets stood up in a week, the demo looks good, and then eighteen months of the team’s life go into relevance: why the obvious result is third, why a plural does not match a singular, why the product everyone searches for by its nickname cannot be found by its nickname. The infrastructure was never the hard part. The infrastructure was the part that looked hard.
That reframing should drive the buying decision. You are not choosing a fast index. Every option here is fast enough for the corpus most teams have. You are choosing how much relevance work you will do, who will do it, and what the feedback loop looks like when a stakeholder says the results are wrong.
The second thing worth saying early: a great many search features are shipped on a database the team already runs, and should be. If you have a modest number of documents, structured filters, and users who search for things that are actually in the text, a full-text index in your existing database will serve you for a long time and will cost you one afternoon rather than one cluster. Ruling that out deliberately is the correct first step, and it is the step most teams skip because a search engine feels like the serious answer.
I am not going to publish latency or throughput numbers here, because I have not benchmarked these on one dataset and numbers from different corpora compared side by side are worse than no numbers. What follows is the architecture and the consequences that follow from it, which is the part that transfers to your data.
Key takeaways
- Relevance tuning is the cost centre in every search project. Pick the tool whose tuning model matches who will be doing that work.
- Index time is a consequence of the analysis pipeline and the refresh and merge policy, not a fixed property of a product. The same engine can be near-instant or minutes behind depending on configuration.
- Postgres full-text search covers more cases than its reputation suggests. Rule it out with a reason, not by default.
- Hybrid search combining keyword and vector scoring is the current default for anything resembling natural language queries, and how a tool fuses the two rankings matters more than which vector index it uses.
What indexing actually costs you
An inverted index maps each term to the documents containing it. Building one means taking each document, running it through an analysis pipeline, and writing postings for the resulting terms.
The analysis pipeline is where index time is decided, and it is entirely under your control. Tokenisation splits text into terms. Lowercasing and Unicode normalisation make matching case and accent insensitive. Stemming or lemmatisation reduces words to a root so that a search for one form matches another. Stop word handling decides whether very common words are indexed. Synonym expansion adds alternative terms. N-gram or edge-gram tokenisation, used to support typo tolerance and prefix matching, multiplies the number of terms per document enormously, which is why a field configured for as-you-type search costs far more to index and store than the same field configured for ordinary matching.
Then there is the write path. Most engines in this family are built on immutable segments: documents are buffered, flushed into a new segment, and made searchable at a refresh point. Smaller segments are cheap to create and expensive to query, so a background merge process combines them, which is I/O-heavy work competing with your queries for the same disk and CPU.
Three configuration choices dominate everything else here.
The refresh interval decides how long after a write a document becomes searchable. Making it very short means frequent tiny segments and constant merging. Loosening it, even a little, is often the single largest indexing throughput improvement available, and most applications tolerate a short delay perfectly well.
Replica count during bulk loads matters because every replica repeats the indexing work. Loading a large corpus with replicas disabled and enabling them afterwards changes the arithmetic substantially.
Field configuration matters because indexing a field you never search, or storing the full document alongside an index when you already have it in your primary database, is pure cost. Most schemas in the wild index considerably more than they query.
Needs first-hand data: Take a representative slice of your real corpus, ideally the same slice across every candidate, and measure three things per tool: wall-clock time for the bulk load, on-disk index size, and the delay between a write completing and that document appearing in results under default settings. Then repeat with your typo tolerance or prefix-matching feature enabled. The ratio between those two runs is the real cost of that feature on your data, and it varies more between corpora than between products.
BM25 and why relevance is the real project
BM25 is the scoring function nearly every keyword search engine uses, and it is an algorithm rather than a product, so it is not something you select between. It is worth understanding because it explains most of the surprising rankings you will spend your time explaining to other people.
It scores a document for a query using three ingredients. Term frequency: how often the term appears in the document, with diminishing returns so that ten occurrences do not score ten times one. Inverse document frequency: how rare the term is across the whole corpus, so that a rare term contributes far more than a common one. And field length normalisation: a match in a short field counts for more than the same match in a long one, on the reasoning that a short document about the term is more likely to be about the term.
That third ingredient produces the single most common complaint in search. A product whose title is exactly the query can rank below one with a long description mentioning the query several times, or the reverse, depending on how the fields are weighted. Understanding that the scoring is doing something principled, rather than being broken, is what lets you fix it with field boosts instead of by adding another engine.
What BM25 cannot do is understand meaning. It matches terms. A query for a concept expressed in words absent from the document scores zero, no matter how relevant the document is. That gap is what vector search fills and why hybrid retrieval became standard.
The work that actually consumes a search project, in rough order of effort:
Field weighting. Deciding that a title match matters more than a body match, and by how much. This is empirical and it is never finished.
Synonyms and domain vocabulary. Every domain has terms users type that do not appear in your documents: abbreviations, internal names, competitor names, misspellings that have become conventional. This list is built by reading query logs, forever.
Business rules on top of relevance. Boosting in-stock items, recent content, or the customer’s own documents. Pure relevance and business value are not the same ranking and reconciling them is a product decision as much as a technical one.
Zero-result and low-quality-result handling. The queries that return nothing are the most valuable diagnostic data you have, and most teams do not log them.
Measurement. Without click-through and conversion data attached to queries, every relevance change is an argument between opinions. This is the piece that separates teams whose search improves from teams whose search is re-tuned every six months by whoever complains loudest.
Postgres full-text search: the option to rule out first
Postgres has built-in full-text search. It is a feature of a database you probably already run, not a product, and it is the correct answer more often than the search industry would like.
The mechanism is direct: a tsvector column holds the analysed, normalised tokens for a document, a GIN index makes lookups on it fast, and tsquery expresses the search. Ranking functions provide a relevance score with field weighting, and the whole thing participates in ordinary SQL, which is the property that makes it powerful.
What it gives you
- Search results in the same query as your joins, filters and permissions, with transactional consistency and no synchronisation to build or monitor. The entire class of “the index is out of date” bugs does not exist.
- Stemming, stop words and configurable dictionaries for many languages, with synonym and thesaurus support through dictionary configuration.
- Weighted ranking across fields, so a title match can outrank a body match without an external scoring layer.
- Trigram similarity through an extension for fuzzy matching and misspellings, which covers a good share of what people install a search engine for.
- No new infrastructure, no new failure mode, no data duplication, no second security model, and nothing extra to back up.
What it does not do
- Typo tolerance and prefix matching are workable through trigrams and prefix queries but are not the engineered, tuned experience that dedicated search tools provide out of the box.
- Relevance tuning is SQL and index configuration rather than a purpose-built tuning interface, so iterating on ranking is slower and harder to hand to a non-engineer.
- Faceted navigation with counts across many fields means aggregate queries that compete with your transactional workload on the same instance.
- It scales with your database rather than independently, so a heavy search workload consumes resources your application needs, and a very large corpus with complex queries will eventually outgrow it.
- No built-in typo-tolerant autocomplete, no query understanding, no analytics on searches, and no relevance experimentation framework.
The honest rule: if your search is a filter with a text component, over a corpus your database comfortably holds, on a product where search is a feature rather than the product, start here. Move when you can name what specifically broke. Your managed Postgres provider may also offer extensions that stretch this further than the built-in version does; the Postgres extensions guide covers which ones are worth enabling.
Hybrid search, and where pgvector fits
Keyword search fails when the user does not use your words. Vector search fails at exact identifiers, part numbers, names and rare terms, because an embedding of a product code carries almost no meaning. Hybrid retrieval runs both and combines the rankings, and it is now the default design for anything with natural-language queries.
The combination step is where implementations differ and where quality is won or lost. The common approach is reciprocal rank fusion, which merges two ranked lists by position rather than by score, sidestepping the problem that BM25 scores and vector similarities are not on a comparable scale. The alternative is normalising and weighting the scores directly, which is more tunable and more fragile. A tool that only gives you one of these, with no ability to adjust the weighting, will eventually constrain you.
pgvector is a Postgres extension adding a vector type with approximate nearest neighbour indexing. Like full-text search, it is a feature rather than a product, and its significance here is that it makes hybrid search possible inside Postgres: a query can compute a BM25-style rank from a tsvector column and a similarity from a vector column, combine them, and apply your ordinary SQL filters and permissions in the same statement. For a team already on Postgres with a moderate corpus, that is a complete hybrid search implementation with no new infrastructure and no synchronisation.
Its limits are the limits of running search on your transactional database: index build times on large vector sets are substantial, the memory characteristics of the index matter a great deal, and heavy vector queries compete with your application workload. At scale, a dedicated vector index or a search engine that handles both modes natively wins. The vector database comparison covers that decision in depth.
One thing worth stating because it gets lost: whichever retrieval you use, you still need the same relevance work. Embeddings do not remove the need for synonyms, field weighting or business rules. They change which queries fail rather than eliminating failure.
Elasticsearch
Elasticsearch is the reference implementation of a distributed search engine and the one everything else is compared against. Built on Lucene, it offers a very deep query language, aggregation framework, analysis pipeline and cluster model, and there is more written about tuning it than about any other tool in this category. That depth is both its strength and its cost: you can express nearly any relevance requirement, and you will need to understand shards, mappings, refresh and merge policy to run it well.
Pros
- The most expressive query and analysis capability here, so almost any relevance requirement can be expressed without leaving the tool
- Aggregations make faceted navigation, analytics and reporting on the search corpus first-class rather than bolted on
- Enormous documentation, community knowledge and operational experience, which means your specific problem has almost certainly been solved in public
- Mature support for both keyword and vector retrieval in one engine, so hybrid search does not require a second system
Cons
- Cluster operation is a genuine specialism: shard sizing, heap management, mapping explosions and merge pressure all cause outages for teams who treated it as a database
- Mappings are largely immutable, so a field type decision made early requires a reindex to change, and reindexing a large corpus is a project
- The licensing history has left real uncertainty in some organisations, and the cost model for the managed offering scales with data volume in ways that punish over-indexing
Best for: Teams with complex relevance requirements, aggregation-heavy query needs, and either the operational depth to run a cluster or the budget for the managed service.
Pricing: Managed offerings are priced on provisioned resources across hot and cold tiers plus data transfer; self-hosted is free of licence cost under its source-available terms with commercial features gated by subscription.
OpenSearch

OpenSearch is the Apache-licensed fork of Elasticsearch, maintained in the open with substantial cloud-provider backing. Architecturally it is the same lineage, with the same sharding model, similar query semantics and a similar analysis pipeline, so most of what you know transfers. Its arguments are licence clarity, an open governance model, and tight integration with the AWS ecosystem for teams already there.
Pros
- Apache licence removes the licensing ambiguity that makes some organisations uncomfortable with the alternative
- Familiar architecture and query model, so existing Elasticsearch knowledge and much existing tooling transfer with limited friction
- Strong managed offering in the AWS ecosystem with integrated identity, networking and storage tiering
- Built-in vector search and hybrid retrieval support, developed in the open rather than behind a commercial tier
Cons
- Feature parity with the upstream project has drifted in both directions, so a feature you read about may exist in one and not the other; verify against the version you will actually run
- Inherits every operational difficulty of the underlying architecture, including shard sizing, heap pressure and merge storms
- The ecosystem of third-party clients and integrations is thinner, and some tooling still assumes the other project
Best for: Teams who want the Lucene-based feature set with an unambiguous open licence, particularly those already standardised on AWS.
Pricing: Managed service billed on instance hours and storage across tiers; self-hosted carries no licence cost, only infrastructure and operations.
Typesense

Typesense is a purpose-built search engine that optimises for a specific experience: typo-tolerant, instant, as-you-type search with sensible defaults. It is a single binary written in C++, holds its index in memory, and exposes a small API surface that is deliberately much smaller than the general-purpose engines. That constraint is the product: fewer decisions to make, fewer ways to configure it badly, and results that are good immediately rather than after a tuning project.
Pros
- Typo tolerance and instant search work well by default, which is precisely the experience most teams are trying to build and the one that takes longest to tune elsewhere
- Small, comprehensible configuration surface means a working search in hours with few opportunities to misconfigure it into an outage
- Single binary with in-memory index is straightforward to run, and the deployment model is a container rather than a cluster architecture
- Open source with a managed cloud from the same team, so self-hosting and managed hosting are the same software
Cons
- In-memory index means your corpus must fit in RAM, which sets a hard and relatively expensive ceiling as data grows
- Query and aggregation expressiveness is far below the Lucene-based engines; complex analytical or deeply nested queries are not what it is for
- Smaller ecosystem and smaller body of public operational experience, so unusual problems have fewer existing answers
Best for: Product teams building user-facing instant search over a corpus that fits comfortably in memory, who want good results without a relevance project.
Pricing: Open source with no licence cost self-hosted; the managed cloud is priced on provisioned memory, CPU and replica count rather than on query volume.
Meilisearch

Meilisearch occupies similar ground to Typesense: a focused, developer-friendly engine tuned for instant search with typo tolerance, strong defaults and a small API. It is written in Rust, ships as a single binary, and its ranking model is a configurable, ordered set of rules rather than a single opaque score, which makes relevance behaviour unusually easy to reason about and explain to a non-engineer.
Pros
- The ordered ranking-rule model makes relevance legible: you can see and reorder the criteria rather than reverse-engineering a score
- Excellent defaults for typo tolerance, prefix matching and faceting, so the first implementation is usually close to the final one
- Simple deployment as a single binary, with a managed cloud available from the same team
- Clear, well-organised documentation and a small enough surface that a whole team can understand the configuration
Cons
- Memory and disk characteristics constrain corpus size, and very large collections are not what the architecture is aimed at
- Aggregation and analytical query capability is limited compared with the general-purpose engines
- The ranking-rule model is easy to reason about and less expressive at the edges, so unusual relevance requirements can hit a wall that a scoring-function engine would not
Best for: Teams who want instant search with relevance behaviour they can explain to a product manager, over a corpus of moderate size.
Pricing: Open source with no licence cost self-hosted; managed cloud priced on index size and search request volume tiers.
Algolia

Algolia is a hosted search product rather than a search engine you operate, and it is priced accordingly. What you buy is the whole apparatus around relevance: a tuning interface non-engineers can use, A/B testing of ranking configurations, query analytics, merchandising rules, and front-end components that implement the search experience. For a commerce or content product where search directly drives revenue, that apparatus is frequently worth more than the engine underneath it.
Pros
- The relevance tooling is the most complete here: analytics, experimentation and rule management that let a non-engineer own search quality
- Front-end libraries implement the search experience, including autocomplete, faceting and result display, which removes a substantial amount of work
- Fully managed and globally distributed, so there is no cluster, no sizing and no capacity planning
- Merchandising and business rules are first-class, which matters when the correct ranking is a commercial decision rather than a relevance one
Cons
- Cost scales with search volume and record count, and a high-traffic public search surface can become one of the larger lines in an infrastructure budget
- Proprietary and hosted, so your index and your relevance configuration live with the vendor and migrating away means rebuilding both
- Deep or unusual query requirements can hit the limits of a curated API in a way they would not with a general-purpose engine
Best for: Commerce and content products where search drives revenue and a non-engineering team should own relevance and merchandising.
Pricing: Metered on search requests and indexed records, with tiers adding analytics, experimentation and personalisation features; the meter scales with traffic rather than with infrastructure.
Vespa

Vespa is a serving engine rather than a search engine, and the distinction is real. It combines structured filtering, keyword retrieval, vector search and the execution of ranking models in a single query, with ranking expressed as configurable expressions and machine-learned models evaluated at serving time over the retrieved candidates. It is what you reach for when ranking itself is the product and a two-stage retrieve-then-rerank pipeline needs to run inside one system.
Pros
- Native support for a full retrieve-and-rerank pipeline, including evaluating machine-learned ranking models over candidates inside the engine
- Keyword, vector and structured filtering combine in one query with one ranking expression, rather than being fused after the fact
- Designed for large-scale, low-latency serving with real-time writes, so index freshness and query serving are not in tension
- Ranking configuration is expressive enough to encode genuinely complex relevance and business logic in one place
Cons
- Substantially steeper learning curve than anything else here: its configuration model, schema language and deployment concepts are its own and transfer from nothing
- Operational complexity is high, and the community is smaller, so you will be reading the source and the reference documentation rather than blog posts
- Overkill for a straightforward site or catalogue search, where its power translates into weeks of setup for a result another tool gives you in a day
Best for: Teams where ranking quality is the core product and a learned reranking model over hybrid retrieval is the requirement, not a nice-to-have.
Pricing: Open source with no licence cost self-hosted; a managed cloud is priced on provisioned compute and storage for the serving cluster.
How to choose
Run through this in order and stop at the first honest answer.
Can your existing database do it? Corpus in the low millions of documents, queries that are filters plus text, search as a feature rather than the product. If all three are true, use your database’s full-text index and spend the saved time on the query log instead. Revisit when you can name the specific thing that broke.
Is the experience instant, typo-tolerant, as-you-type search over a bounded corpus? A focused engine gives you that experience in days rather than months. The general-purpose engines can do it too, after configuration work you do not need to do.
Is search a revenue surface that non-engineers must control? Buy the hosted product with the tuning and experimentation apparatus. The engine is not what you are buying and comparing it on engine features misses the point entirely.
Do you need aggregations, complex queries and full control, at scale? A Lucene-based engine, and budget the operational expertise honestly. The cost of running one badly is much higher than the cost of running one well.
Is ranking itself the product? A serving engine that executes learned models over hybrid retrieval. Accept the learning curve; nothing else does this in one system.
One further consideration that decides more than teams expect: if you are also using a search engine to store logs, you now have two very different workloads on one cluster, and they conflict on retention, shard size and hardware. That is worth separating, and the log storage comparison covers why a column store usually wins for logs even when a search engine wins for search.
| Tool | Model | Relevance tuning owner | Vector and hybrid | Operational burden |
|---|---|---|---|---|
| Elasticsearch | Distributed Lucene | Engineers, via query DSL | Built in | High |
| OpenSearch | Distributed Lucene fork | Engineers, via query DSL | Built in | High |
| Typesense | In-memory, purpose-built | Defaults plus light config | Built in | Low |
| Meilisearch | Single binary, rule-ranked | Ordered ranking rules | Built in | Low |
| Algolia | Hosted product | Non-engineers, via dashboard | Built in | None |
| Vespa | Serving engine | ML engineers, via ranking expressions | Native, first-class | Very high |
| Postgres full-text search (feature, not a product) | Index in your database | Engineers, via SQL | With pgvector | None extra |
Needs first-hand data: Build a relevance judgement set before you choose anything. Take the two hundred most frequent real queries from your logs, have someone who knows the domain mark the correct results for each, and score every candidate configuration against that set using a standard ranking metric. Re-run it on every relevance change forever. Without this, every future search discussion is decided by whoever complains most persuasively, and you will re-tune the same configuration indefinitely.
Frequently asked questions
Can Postgres replace Elasticsearch?
For many applications, yes. Full-text search with GIN indexes, weighted ranking and trigram similarity covers filter-plus-text search over a moderate corpus, with the significant advantage that results are transactionally consistent and joinable with the rest of your data. It falls behind on engineered typo tolerance, on faceted navigation at scale, and on giving non-engineers a way to tune relevance. Decide on those specifics rather than on reputation.
What is hybrid search and do I need it?
Hybrid search runs keyword and vector retrieval together and fuses the rankings. You need it when users express queries in words that are not in your documents, which is most natural-language search. You do not need it when queries are identifiers, part numbers or names, where keyword matching is both better and cheaper. Most real products have some of each, which is the argument for hybrid rather than a switch from one to the other.
How do I know if my search is actually bad?
Instrument it. Log every query, whether it returned results, which result was clicked, at what position, and whether the session converted. Zero-result queries and queries where users click nothing are your improvement backlog, ranked by frequency. Without this data you have opinions, and opinions lose to whoever is loudest in the room.
Should search run on the same cluster as my logs?
No. Log data is append-heavy, time-ordered, retained briefly and rarely re-scored. Search data is update-heavy, relevance-scored and retained indefinitely. They want different shard sizes, different hardware and different retention, and putting them together means one workload’s incident is the other’s outage too.
Related reading
- Best managed Postgres providers — what your database already offers before you add a search cluster.
- Elasticsearch vs Loki vs ClickHouse — why the same engine that wins for search loses for logs.
- Best vector databases — the embedding half of hybrid retrieval, in depth.
- Best Postgres extensions for production workloads — the extensions that stretch in-database search further.
- Best analytics and OLAP databases — where faceting and aggregation workloads belong at scale.