---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://mixpeek.com/.well-known/search?q={query}"
  method: GET
  documentation: "https://mixpeek.com/llms.txt"
---

1.  [](/)
2.  [Code examples](/recipes)
3.  Dense Search Over Your Own Embeddings, and What Hybrid Needs

Back to code examples

Similar

# Dense Search Over Your Own Embeddings, and What Hybrid Needs

Upsert documents you embedded elsewhere into an MVS namespace and search them by raw vector through the features search endpoint. Hybrid BM25 plus dense is not part of a plain BYO upsert: the documents carry dense vectors only and no text index is created. If you want a lexical leg later, declare a TEXT payload index on the field when you create the namespace; this recipe shows that declaration and the dense search that works today.

text

Single Tier

[Run in Builder](/build?recipe=mvs-hybrid-bm25-dense)

"FastAPI Pydantic v2 validation patterns"

### Why This Matters

Pure vector search misses exact identifiers and error codes, and teams that bring their own embeddings often assume keyword matching comes with the vector store. On BYO documents it does not unless the text index exists before the first upsert. Declaring it up front is cheap; discovering its absence after indexing a corpus is not.

Python

cURL

import requests

from openai import OpenAI

from mixpeek import Mixpeek

openai \= OpenAI(api\_key\="YOUR\_OPENAI\_KEY")

client \= Mixpeek(api\_key\="YOUR\_API\_KEY")

NAMESPACE \= "byo-hybrid"

HEADERS \= {"Authorization": "Bearer YOUR\_API\_KEY"}

def embed(text):

    return openai.embeddings.create(model\="text-embedding-3-small", input\=text).data\[0\].embedding

\# 1. A standalone namespace for your vectors

client.namespaces.create(

    namespace\_id\=NAMESPACE,

    mode\="standalone",

    vector\_configs\=\[{"name": "dense", "dimension": 1536, "metric": "cosine"}\],

)

\# 2. BM25 reads the namespace's text payload indexes, so declare one on the field that

\#    holds the text before the first upsert. The SDK has no namespace update, so this is REST.

requests.patch(

    f"https://api.mixpeek.com/v1/namespaces/{NAMESPACE}",

    headers\=HEADERS,

    json\={"payload\_indexes": \[{"field\_name": "content", "type": "text"}\]},

)

\# 3. Upsert vectors with the text in the indexed payload field

documents \= \[

    "FastAPI uses Pydantic v2 for data validation and serialization",

    "Express.js middleware handles request and response transformations",

    "Django ORM provides database abstraction with the QuerySet API",

\]

client.namespaces.documents.upsert(

    namespace\_id\=NAMESPACE,

    documents\=\[

        {"document\_id": f"doc-{i}", "vectors": {"dense": embed(text)}, "payload": {"content": text}}

        for i, text in enumerate(documents)

    \],

)

\# 4. One stage runs both legs: dense on the vector, lexical on the text, fused with RRF

retriever \= client.retrievers.create(

    retriever\_name\="byo-hybrid-search",

    input\_schema\={"qv": {"type": "array", "required": True}, "query": {"type": "text", "required": True}},

    stages\=\[

        {

            "stage\_name": "search",

            "stage\_id": "feature\_search",

            "parameters": {

                "searches": \[

                    {

                        "feature\_uri": "dense",

                        "query": {"input\_mode": "vector", "value": "{{INPUT.qv}}"},

                        "top\_k": 20,

                    },

                    {

                        "feature\_uri": "dense",

                        "query": {"input\_mode": "text", "value": "{{INPUT.query}}"},

                        "top\_k": 20,

                        "lexical": True,

                    },

                \],

                "fusion": "rrf",

                "final\_top\_k": 5,

            },

        },

    \],

)

query \= "FastAPI Pydantic validation"

results \= client.retrievers.execute(retriever\["retriever\_id"\], inputs\={"qv": embed(query), "query": query})

for doc in results\["documents"\]:

    print(round(doc\["score"\], 3), doc.get("content"))

### Feature Extractors

### Retriever Stages

feature search

Search and filter documents by vector similarity using feature embeddings

filter

### Documentation

[MVS Overview](https://mixpeek.com/docs/vector-store/overview)[Hybrid Search](https://mixpeek.com/docs/vector-store/overview)[BM25 Configuration](https://mixpeek.com/docs/vector-store/overview)

## Related code examples and resources

Pages on the same stages, extractors and patterns.

[

Recipe

### Document Intelligence Search

Extract and search through PDFs, presentations, and documents. Combines OCR, layout analysis, and semantic search for comprehensive document retrieval.

Learn more





](/recipes/document-search-pipeline)[

Recipe

### BYO Embeddings Vector Search

Bring pre-computed embeddings from any provider (OpenAI, Cohere, Together, etc.) and upsert them directly into MVS for instant vector search. No feature extractors, no pipelines -- just embeddings in, results out.

Learn more





](/recipes/mvs-byo-embeddings-search)[

Recipe

### RAG with MVS Standalone

Complete RAG pipeline using MVS for retrieval and OpenAI for generation. Chunk your documents, embed them with any provider, store in MVS, retrieve relevant context, and generate answers -- no managed feature extractors needed.

Learn more





](/recipes/mvs-rag-pipeline)[

Extractor

### Web Scraper

Extract structured data from webpages while maintaining semantic context and relationships

Learn more





](/extractors/web-scraper)[

Extractor

### Text Embedding

Extract semantic embeddings from documents, transcripts and text content

Learn more





](/extractors/text)[

Recipe

### Multimodal Hybrid Search Pipeline

Combine vector search with keyword search (BM25) across text, images, and video for the most comprehensive multimodal retrieval system.

Learn more





](/recipes/multimodal-hybrid-search)