Quick revision
The short answer
The default is vector support in databases we already operate, PostgreSQL with pgvector or our existing search cluster, and a dedicated vector database only when a team proves it needs the scale or a feature the default lacks. Application code uses Spring AI's VectorStore abstraction, with its portability limits stated openly, while the company standardises metadata, access filters and deletion, sets capacity, cost, backup and restore rules, and approves any new store only after an evaluation on real data for recall, latency and cost.
What to remember
In this answer, we set a vector storage standard that defaults to pgvector or the existing search cluster and allows dedicated vector databases only for proven needs. Services use Spring AI's VectorStore abstraction with its limits on filters, index types and hybrid search acknowledged. Every chunk carries standard metadata so tenant filters and privacy deletion work everywhere, capacity and cost are sized up front, backup and rebuild are defined, and new stores are approved only after an evaluation on real data.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The default is vector support in databases we already operate, PostgreSQL with pgvector or our existing search cluster, and a dedicated vector database only when a team proves it needs the scale or a feature the default lacks. Application code uses Spring AI's VectorStore abstraction, with its portability limits stated openly, while the company standardises metadata, access filters and deletion, sets capacity, cost, backup and restore rules, and approves any new store only after an evaluation on real data for recall, latency and cost.
Why this question is asked
Vector search arrived quickly, and every team that built a RAG feature picked whatever its tutorial used. A year later the company runs four kinds of vector storage, each with its own backups, access model and on-call knowledge, and nobody can say how customer data is deleted from all of them. Interviewers ask senior engineers this question to see whether they can set a standard that reduces risk without blocking legitimate needs. In this answer, we will set the default, decide where the abstraction helps and where it leaks, standardise metadata and deletion, define capacity and operations, and describe how a team gets approval for something else.
1Start From What We Already Operate
Every datastore we run costs more than its licence: backups, upgrades, monitoring, security reviews, access control, and people on call who understand it at 3 am. A new vector database adds all of that. Most RAG workloads are modest, from tens of thousands to a few million chunks, and PostgreSQL with pgvector handles that comfortably with an HNSW index. If the company already runs Elasticsearch or OpenSearch for search, its vector fields are an equally natural default, especially when we also need keyword search.
So the policy is: use pgvector in the PostgreSQL we already operate, or vector fields in the existing search cluster, unless a team shows with numbers that it needs more. A dedicated vector database is a valid choice at very large scale or for specific features, but it is an exception that must be earned.
| Option | Good fit | Cost of choosing it |
|---|---|---|
| PostgreSQL + pgvector | default; up to a few million chunks | low: already operated |
| Search cluster vectors | hybrid keyword and vector search | low if the cluster exists |
| Redis vectors | small, latency-critical, cache-like sets | memory cost; persistence choices |
| Dedicated vector database | proven very large scale or special features | new ops, contracts, security review |
2Use the Spring AI Abstraction, Knowing Its Limits
Spring AI's VectorStore interface lets services add documents, delete them and run similarity searches without depending on a specific store. Switching from pgvector to Elasticsearch is then mostly a starter and configuration change, which is valuable for tests and future moves.
But the abstraction is not a promise that every store behaves the same, and the standard should say so. The portable filter expression language is translated per store, and not every operator or nesting is supported everywhere. Index types differ (HNSW, IVFFlat, store-specific options), as do distance functions and their tuning parameters. Hybrid search, combining keyword relevance with vector similarity, is a native strength of search engines and is not covered by the common interface in the same way. So the guidance is: write normal code against VectorStore, keep store-specific features behind a small adapter of our own, and test filters on the actual store.
3Standardise Metadata, Access and Deletion
This is where standards matter most, because it is where the risk lives. Every chunk in every store carries the same core metadata: tenant id, source system, document id, document version, embedding model and version, and a data classification label. With those fields, the same operations work everywhere.
Access control is enforced the same way in every service: the platform starter adds the tenant filter, and for finer permissions, a filter on groups or document ACLs, so no team builds its own. Deletion for privacy requests must reach every store, which only works if every chunk can be found by the source document and its owner. Notice also the embedding model field: it lets us detect mixed models and plan re-embedding.
4Capacity and Cost Models
Vector storage is easy to underestimate because one row looks small. Each vector of 1,536 float32 values is about 6 KB before index overhead. Ten million chunks is roughly 60 GB of vectors, and an HNSW index adds more and performs best when it fits in memory. So the standard gives teams a simple sizing sheet: number of chunks, dimensions, bytes per dimension, index overhead, replicas, and the resulting memory, disk and monthly cost. A team planning 50 million chunks sees early that it is in a different class and should talk to the platform team.
Choosing a smaller embedding dimension, where the model supports it, or storing vectors as half-precision where the store allows, can cut size substantially, and the sizing sheet makes that trade-off visible.
- Services
VectorStoreAPI; store specifics behind an adapter - Platform starterrequired metadata, tenant filter, deletion
- Default storespgvector, existing search cluster
- Operationssizing sheet, backups, restore tests
- Exception pathevaluation on real data, then approval
5 layers, from the top down. Step through them one at a time.
5Backup, Restore and Rebuild
For each approved store we define how it is backed up and, more importantly, tested by restoring it. Vector data has one special property: it can be rebuilt from the source documents by re-embedding. That does not remove the need for backups, because a full rebuild can take days and cost real money at scale, but it means the procedure should state both options, restore time from backup and rebuild time from source, so incident leads can choose.
6How a Team Gets Approval for Another Store
When a team believes the default is not enough, it runs an evaluation on its own data and queries: recall at k on a labelled query set, p95 latency at expected load, ingestion speed, and monthly cost including operations. It compares against the default store tuned properly, since an untuned pgvector index is not a fair baseline. If the alternative clearly wins on something the product needs, the platform team approves it, adds it to the supported list with backup, access and deletion procedures, and other teams can then use it too. If not, the team stays on the default and the evaluation is published so the next team does not repeat it.
7Follow-up questions
When would hybrid keyword and vector search be required?
When exact terms matter as much as meaning: product codes, error numbers, legal clause references, names, or short queries where embeddings are weak. A search for error E-4471 should find documents containing that exact code even if their overall meaning is not close. Hybrid search runs a keyword search and a vector search and combines the rankings, often with reciprocal rank fusion. Search engines support it natively, and PostgreSQL can approximate it by combining full-text search with pgvector in one query.
Why not let each team choose freely?
Because the risks are shared: customer data in an unreviewed store, deletion requests that miss a copy, and on-call engineers who do not know a system. Freedom stays available through the exception path, backed by evidence.
Does the abstraction make migration free?
No. Code changes are small, but data must be re-indexed, filters retested and performance re-tuned on the new store.
8Conclusion
In this answer, we set a vector storage standard that defaults to pgvector or the existing search cluster and allows dedicated vector databases only for proven needs. Services use Spring AI's VectorStore abstraction with its limits on filters, index types and hybrid search acknowledged. Every chunk carries standard metadata so tenant filters and privacy deletion work everywhere, capacity and cost are sized up front, backup and rebuild are defined, and new stores are approved only after an evaluation on real data.
Open with
My default would be to use vector support in databases we already run: PostgreSQL with pgvector for most workloads, or vector fields in our existing search cluster when we also need keyword search.
Then, if they want more
A dedicated vector database is allowed, but only when a team proves it needs the scale or a feature, because every new store brings backups, upgrades, security reviews and on-call knowledge.
In code, teams use Spring AI's VectorStore abstraction, but I would be honest about its limits: filter expression support, index types, distance tuning and hybrid search differ between stores, so store-specific features go behind a small adapter and filters are tested on the real store.
The most important standard is metadata: every chunk has tenant, source, document id and version, embedding model and classification, the platform starter adds tenant filters to every search, and deletion for privacy requests works the same way in every store.
I would also publish a sizing sheet for dimensions, rows and index memory, and define backup, restore tests and rebuild-from-source times. Any new store gets approved after an evaluation on the team's own data for recall, latency and cost against a properly tuned default.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring AI reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Teams are adopting different vector stores (PGvector, Elasticsearch, Redis, a hosted...": https://scrivio-interview-library.netlify.app/spring-boot/spring-ai/1998fed78a/