Skip to main content
Semantic search stage showing query embedding and vector similarity search
The Semantic Search stage finds documents by meaning using dense vector embeddings. It converts your query into a vector using the same embedding model used during indexing, then finds the most similar documents using approximate nearest neighbor (ANN) search.
Stage Category: FILTER (Reduces document set)Transformation: Collection → top_k documents (ranked by similarity)

When to Use

Use CaseDescription
Natural language search”wireless headphones with noise cancellation”
Conceptual matchingFind docs with similar meaning, not just keywords
Cross-modal searchText query → find matching videos/images
Multilingual searchQuery in one language, find docs in another
RAG retrievalRetrieve context for LLM generation

When NOT to Use

ScenarioRecommended Alternative
Exact phrase matchinghybrid_search with text weight
Keyword-heavy querieshybrid_search or full-text search
Product SKUs/model numbersstructured_filter on exact fields
Very short queries (1-2 words)hybrid_search for better recall

Parameters

ParameterTypeDefaultDescription
querystringRequiredSearch query (supports templates like {{INPUT.query}})
vector_indexstringRequiredName of the vector index to search
top_kinteger100Number of candidates to retrieve
min_scorefloat0.0Minimum similarity score threshold (0.0-1.0)
filtersobjectnullPre-filter conditions (applied before vector search)

Vector Index Selection

The vector_index must match an index created by a feature extractor:
Feature ExtractorIndex NameDimensions
text_extractor_v1text_extractor_v1_embedding1024
multimodal_extractor_v1multimodal_extractor_v1_multimodal_embedding1408
multimodal_extractor_v1multimodal_extractor_v1_transcription_embedding1024

Configuration Examples

{
  "stage_type": "filter",
  "stage_id": "semantic_search",
  "parameters": {
    "query": "{{INPUT.query}}",
    "vector_index": "text_extractor_v1_embedding",
    "top_k": 100
  }
}

How It Works

  1. Query Embedding: Your query is converted to a vector using the same model that indexed the documents
  2. ANN Search: Approximate nearest neighbor search finds the top_k most similar vectors
  3. Score Calculation: Cosine similarity is computed (0.0 = orthogonal, 1.0 = identical)
  4. Filtering: Optional pre-filters are applied to narrow the search space
  5. Ranking: Results are returned sorted by similarity score (highest first)

Output

Each returned document includes:
FieldTypeDescription
document_idstringUnique document identifier
scorefloatSimilarity score (0.0-1.0)
contentstringDocument content
metadataobjectDocument metadata

Performance

MetricValue
Latency5-50ms for millions of vectors
top_k range1-10,000
Index typeHNSW (Hierarchical Navigable Small World)
Distance metricCosine similarity
Use larger top_k values (100-500) when planning to rerank results with the rerank stage. The reranker will select the best final results from this candidate pool.

Pre-Filtering

Pre-filters are applied before vector search, using indexed metadata fields:
{
  "filters": {
    "AND": [
      {"field": "metadata.status", "operator": "eq", "value": "published"},
      {"field": "metadata.date", "operator": "gte", "value": "2024-01-01"}
    ]
  }
}
Supported operators: eq, ne, gt, lt, gte, lte, in, nin, contains, exists

Common Pipeline Patterns

Two-Stage Retrieval (Retrieve + Rerank)

[
  {
    "stage_type": "filter",
    "stage_id": "semantic_search",
    "parameters": {
      "query": "{{INPUT.query}}",
      "vector_index": "text_extractor_v1_embedding",
      "top_k": 100
    }
  },
  {
    "stage_type": "sort",
    "stage_id": "rerank",
    "parameters": {
      "model": "bge-reranker-v2-m3",
      "top_n": 10
    }
  }
]

Semantic Search + Structured Filter

[
  {
    "stage_type": "filter",
    "stage_id": "semantic_search",
    "parameters": {
      "query": "{{INPUT.query}}",
      "vector_index": "text_extractor_v1_embedding",
      "top_k": 200
    }
  },
  {
    "stage_type": "filter",
    "stage_id": "structured_filter",
    "parameters": {
      "conditions": {
        "field": "metadata.price",
        "operator": "lte",
        "value": "{{INPUT.max_price}}"
      }
    }
  }
]