Skip to main content
Mixpeek Retrievers
Retrievers combine feature-aware search stages, structured filters, enrichment joins, and optional LLM post-processing into a single executable pipeline. Each retriever has an input schema, a list of target collections, and a deterministic set of stages executed in order.

Build a retriever over your own data

Create a namespace, ingest a few files, and compose your first search pipeline in the Studio — no API key setup required.
Multi-stage retrieval is what makes Mixpeek a warehouse, not a database. No other system offers composable filter → sort → reduce → enrich → apply pipelines over multimodal data. This is the query language for unstructured data — the equivalent of SQL for embeddings across modalities. See the Retrieval Cookbook for ready-to-copy pipeline configurations.

Anatomy of a Retriever

Minimal Working Example

The simplest retriever that performs a feature search. Note the required fields:
  • collection_identifiers is required at the retriever root level when using feature_search stages — the search needs to know which collections to query. (Accepts collection names or IDs.)
  • input_schema is a flat map of input field name → type definition (e.g. { "query": { "type": "text", "required": true } }). It’s required when your stages use {{INPUT.*}} template variables — Mixpeek validates inputs against this schema before execution. It is not JSON Schema: map each field name directly to its { "type": ..., "required": ... } definition — do not wrap it in { "type": "object", "properties": { ... } }. Field type is one of the bucket/input types (text, string, number, boolean, date, image, video, pdf, document_reference, …); required defaults to false.
  • Each stage needs a stage_name and a config object containing the stage_id (e.g. feature_search) and its parameters. stage_type (the category, e.g. filter) is optional but recommended.
Execute it:

Stage Catalog

Stages are the building blocks of retriever pipelines. Each stage belongs to a category that defines its behavior:
Retrieve the live registry with GET /v1/retrievers/stages. Each entry includes stage_id, category, icon, and parameter schema so you can dynamically build configuration UIs or validations.Live stages: https://api.mixpeek.com/v1/retrievers/stages

Filter Stages

Filter stages reduce the document set while preserving the document schema. Use these at the start of your pipeline to narrow down candidates.
Use GET /v1/retrievers/stages?category=filter to retrieve the current list of filter stages and their parameter schemas.

Sort Stages

Sort stages reorder documents without changing the result set. Place these after filters to control ranking.
Use GET /v1/retrievers/stages?category=sort to retrieve the current list of sort stages and their parameter schemas.

Reduce Stages

Reduce stages collapse results into aggregated values. Use these for deduplication, sampling, or summarization.
Use GET /v1/retrievers/stages?category=reduce to retrieve the current list of reduce stages and their parameter schemas.

Group Stages

Group stages reshape results by bucketing documents into logical groups or clusters.
Use GET /v1/retrievers/stages?category=group to retrieve the current list of group stages and their parameter schemas.

Apply Stages

Apply stages transform or restructure documents. Use these to reshape output, call external services, or run custom code.

Enrich Stages

Enrich stages add knowledge to documents using AI models, taxonomies, or cross-collection joins.

Enrich Stage Details

document_enrich

Joins documents with data from another collection, similar to a SQL LEFT JOIN. Each input document produces exactly one output document with added fields from the target collection. When to use:
  • Combine data from multiple collections (e.g., products + catalog info)
  • Attach user profiles, metadata, or related entities
  • Denormalize data at query time
Parameters: *Required for direct joins; not needed when using retriever_id or retriever_config. Examples:

api_call

Enriches documents by calling external HTTP APIs. Enables integration with third-party services (Stripe, GitHub, weather APIs, etc.) to augment documents with real-time data.
Security: This stage makes external HTTP requests. Always use allowed_domains to prevent SSRF attacks. Never store credentials directly—use auth.secret_ref to reference vault-stored secrets.
Parameters: Authentication Types: Examples:

json_transform

Applies a Jinja2 template to each document, rendering the template with full document context and replacing the document with the parsed JSON output. Use this to reformat documents for external APIs or reshape data for downstream consumers. Parameters: Template Context: Examples:

Performs AI-native web search using Exa’s neural ranking system. Creates new documents from web search results, enabling retriever pipelines to incorporate real-time internet content.
This stage creates new documents (0 → M transformation) rather than enriching existing ones. Use it at the start of a pipeline or to augment internal results with external web sources.
Parameters: Output Schema: Each result becomes a document with:
  • metadata.url – Web page URL
  • metadata.title – Page title
  • metadata.text – Text snippet (if include_text=true)
  • metadata.published_date – Publication date (if available)
  • metadata.author – Author name (if available)
  • metadata.search_query – Original query used
  • metadata.search_position – 0-indexed position in results
  • score – Exa relevance score
Examples:

cross_compare

Compares source documents against a reference collection using a cascading match strategy (exact → fuzzy → semantic → visual). Each comparison produces a classified finding with a score and confidence level. Ideal for drift detection, deduplication, and compliance checking.
This stage can output either findings (N → M, one document per comparison) or enriched documents (N → N, results attached as a field). Set output_mode to control this behavior.
Parameters: Examples:

Call GET /v1/retrievers/stages to retrieve the latest stage metadata and parameter schemas.

Execution Lifecycle

  1. Validate Inputs – Mixpeek enforces the retriever’s input_schema.
  2. Walk Stages – Each stage receives the current working set, runs, and outputs a new set.
  3. Apply Paginationlimit, offset, cursor, or keyset pagination is handled after the final stage.
  4. Return Telemetry – Responses include stage_statistics, budget, and optional presigned URLs.
Presigned media URLs are short-lived. Any media field in a result (thumbnail_url, video_segment_url, face_crop_url, and similar) is a signed URL minted fresh on each request and it expires after about 24 hours. The fields are always present, but don’t persist or hard-code a specific URL value — re-run the query to get a fresh one, or fetch the blob through the document API.
Response headers include:
  • ETag – cache validator; pair with If-None-Match for 304 responses.
  • Cache-Control – TTL derived from cache_config.
  • X-CacheHIT or MISS for query-level caching.

Filters & Templates

Structured filters support comparison operators (eq, gt, lte, in, etc.) and logical composition (AND, OR, NOT).

Template Namespaces

Stages support dynamic configuration through template expressions using Jinja2 syntax. Both uppercase and lowercase namespace formats are supported and work identically:
Mixed usage within the same stage is supported. For example, you can use {{INPUT.query}} alongside {{context.budget_remaining}} in the same configuration.
Conditional expressions:
Templated batch size:

Retrievers & Caching

  • Query cache – caches entire responses keyed by inputs, filters, pagination, and collection index signatures.
  • Stage cache – reuse outputs of expensive stages by listing them under cache_stage_names.
  • Inference cache – Engine deduplicates identical model calls.
Use GET /v1/analytics/retrievers/{id}/cache-performance to monitor hit rates and latency improvements.

Pagination Options

Specify the method in pagination.method when executing a retriever.

Execute a Retriever

Response snippet:
credits_used and credits_limit are internal ledger units (1 credit = $0.001). Dollar-based usage and the rate card live in Billing.

Batch Execution

Execute a retriever against multiple inputs in a single request. The retriever is fetched and optimized once, then executed concurrently across all queries with bounded parallelism.
Response:

Streaming

For pipelines with LLM stages that take longer than a few seconds per query, use "stream": true to receive results as each query completes:
The response is an SSE stream:
Keepalive comments (: keepalive) are sent every 15 seconds to keep the connection alive through proxies. Results arrive out of order as each query finishes — use query_index to match results to inputs.

When to use batch

Anonymous Retrievers

Anonymous retrievers let you execute a retriever pipeline in a single API call without persisting it. This is ideal for:
  • Prototyping and experimentation – Test stage configurations quickly without cluttering your retriever list
  • Dynamic pipelines – Build pipelines on-the-fly based on user context or application logic
  • One-off queries – Run complex searches that don’t need to be reused
  • CI/CD testing – Validate retriever configurations in automated tests without creating permanent resources
Use anonymous retrievers during development to iterate quickly, then promote working configurations to named retrievers for production use.
The response format is identical to named retriever execution. The key difference: no retriever_id is created or stored.

Publishing & Display Config

Retrievers can be published as public search interfaces hosted at mxp.co. Publishing requires a display_config that controls how the UI renders inputs, results, and styling. Set display_config when creating or updating a retriever via PATCH /v1/retrievers/{id}:
Key fields: Once display_config is set, publish the retriever with POST /v1/retrievers/{id}/publish.

Maintenance & Versioning

  • Use PATCH /v1/retrievers/{id} to rename retrievers or adjust cache settings (stages and schema are immutable; create a new retriever for breaking changes).
  • List retrievers with filters, search, and sort: POST /v1/retrievers/list.
  • Retrieve execution history: GET /v1/retrievers/{id}/executions.
  • Diagnose pipelines without executing: POST /v1/retrievers/{id}/explain.

Interaction Feedback

Capture user feedback with /v1/retrievers/interactions to power downstream analytics, learning-to-rank, or personalized retrieval:

Best Practices

  1. Start narrow – run a single search stage before adding rerankers or joins.
  2. Push filters early – stage-level filters shrink the candidate set before expensive operations.
  3. Use JOIN strategies wiselydirect for key-based joins, retriever for similarity joins; set join_strategy to control merge behavior.
  4. Enable caching – stage caching plus query caching dramatically reduces latency for repeat queries.
  5. Monitor analytics – use retriever analytics endpoints to optimize parameters, detect slow stages, and understand cache ROI.
Retrievers turn Mixpeek’s primitives—features, taxonomies, clusters, and models—into end-user search experiences. Configure once, execute anywhere, and evolve the pipeline with confidence.