Skip to main content
Vector store retrievers enable similarity-based document retrieval using vector embeddings. The VectorIndexRetriever searches for the most semantically similar nodes to your query.

VectorStoreRetriever

The VectorIndexRetriever is created from a VectorStoreIndex and performs similarity search using embeddings:
Vector store retrievers use cosine similarity (or other distance metrics) to find the most relevant documents:

Top-k Retrieval

Control the number of results returned with the similarityTopK parameter:
Default Value: DEFAULT_SIMILARITY_TOP_K = 2

Filters and Metadata

Filter results based on metadata to narrow your search:

Filter Operators

Supported filter operators:
  • == - Equal to (default)
  • != - Not equal to
  • >, < - Greater/less than (numbers)
  • >=, <= - Greater/less than or equal (numbers)
  • in - Value in array
  • nin - Value not in array
  • any - Contains any (array fields)
  • all - Contains all (array fields)
  • text_match - Full text match
  • contains - Array contains value
  • is_empty - Field is empty or doesn’t exist

Multiple Filters

Combine filters with AND or OR conditions:

Query Modes

Different query modes for specialized retrieval:

Complete Example

Custom Parameters

Pass provider-specific parameters through customParams: