New Tool Radar

Local AI

How to Store Ollama Embeddings in Chroma and Search Them Locally

Turn your notes into searchable vectors with Ollama's embedding model, store them in a local Chroma collection, and query them — so the same notes stay searchable without re-embedding.

Schematic diagram with three steps: embed notes with nomic-embed-text, store the vectors in a local Chroma collection, and search them with a query embedding.

Asking a chat model one question at a time is not the same as searching your notes. Ollama’s /api/embed endpoint turns a piece of text into a vector — an array of numbers that represents its meaning — but a vector sitting in memory is not a searchable store. Chroma is the piece that makes it one: a vector database that runs on a single machine with no server to run, so your notes stay in a collection on disk and you can query them again and again without re-embedding them. The pipeline has four steps — chunk, embed, store, retrieve — and this guide covers the middle two that turn a one-off embedding into a searchable index.

Build the collection

Use a dedicated embedding model, not a chat model: nomic-embed-text via Ollama is the local choice in the guide followed here. Then, in Python:

Step What to run Detail from the guide
1. Pull the model and install the libraries ollama pull nomic-embed-text, then pip install chromadb ollama The embedding model and the chat model are separate pulls; a chat model is the wrong tool for embeddings
2. Chunk each note Split text into passages of about 1000 characters with 150 characters of overlap A reasonable default is 500–1500 characters with 10–20% overlap; overlap stops an answer that straddles a boundary from being cut in half
3. Embed each chunk ollama.embeddings(model="nomic-embed-text", prompt=chunk)["embedding"] The Python client’s embeddings() helper takes a model and a prompt and returns the vector for the chunk
4. Store it in Chroma client = chromadb.PersistentClient(path="./vectordb"), then col.add(ids=[f"{path}:{i}"], embeddings=[vec], documents=[chunk], metadatas=[{"source": str(path), "chunk": i}]) Store the source in metadata — without it you cannot cite where an answer came from; stable IDs like path:index make re-indexing idempotent instead of duplicating chunks

To search, embed the question with the same model and ask Chroma for the nearest chunks: res = col.query(query_embeddings=[qvec], n_results=4). The guide’s warning matters here: never mix embedding models — vectors from different models are not comparable, and changing the embedding model means re-indexing everything.

Try it: three notes, one question

For a fictional example, index three short notes in a collection called docs:

Note Text What should come back first for the question “When is the lamp checked?”
Note A “Mara checked the lamp at noon.” Top match — it is the only note that answers the question
Note B “The supply boat arrives on Tuesdays.” Not returned in the top results
Note C “Lens cleaning happens on Fridays.” Not returned in the top results

Embed the question with nomic-embed-text, query the collection with n_results=4, and the returned chunks should put Note A first, with its source in the metadata. If the best match is barely closer than the worst, retrieval is not discriminating and the answer is guesswork — inspect what retrieval actually returns before any language model sees it. Expected result. We checked the LinuxTools local RAG guide and Ollama’s /api/embed reference. We did not index real documents or run a search.

Limits

Embeddings match meaning, not literal tokens, so for error codes and identifiers combine them with keyword search rather than replacing it. The quality of the whole system is decided by chunking and retrieval, not by the language model — a better model cannot fix bad retrieval, and if the right passage is never retrieved the model will confidently improvise. This guide stores and searches vectors only; it does not generate answers from them, which is the next step of a retrieval setup. We did not test any retrieval ourselves.

Sources

See all