Index¶
An index represents a searchable data structure that enables retrieval operations within QType applications. Indexes provide the foundation for Retrieval Augmented Generation (RAG) patterns, semantic search, and knowledge retrieval workflows by allowing applications to search through large collections of documents, embeddings, or structured data.
Indexes are defined at the application level and referenced by search steps that need to query data.
Key Principles¶
Type Discriminator¶
All indexes must include a type field for proper schema validation:
- type: VectorIndex for vector/embedding similarity search
- type: DocumentIndex for text-based document search
Centralized Definition & Reference by ID¶
Indexes are defined at the application level and referenced by ID:
indexes:
- type: VectorIndex
id: my_vector_db
name: embeddings_collection
embedding_model: text_embedder
args:
host: localhost
port: 6333
flows:
- type: Flow
id: search_flow
steps:
- type: VectorSearch
index: my_vector_db # References by ID
Rules and Behaviors¶
- Unique IDs: Each index must have a unique
idwithin the application. Duplicate index IDs will result in a validation error. - Required Name: The
namefield specifies the actual index, collection, or table name in the external system. - Authentication Support: Indexes can reference an
AuthorizationProviderby ID for secure access to external search systems. - Flexible Configuration: The
argsfield allows index-specific configuration and connection parameters for different backends. - Embedding Model Requirement:
VectorIndexrequires anembedding_modelreference to vectorize queries and match the embedding space of stored documents.
Index¶
Base class for searchable indexes that can be queried by search steps.
- id (
str): Unique ID of the index. - args (
dict[str, Any]): Index-specific configuration and connection parameters. - auth (
Reference[AuthProviderType] | str | None): AuthorizationProvider for accessing the index. - name (
str): Name of the index/collection/table.
Index Types¶
VectorIndex¶
Vector database index for similarity search using embeddings.
- type (
Literal): (No documentation available.) - module (
str): Python module path for the vector store implementation (e.g., 'llama_index.vector_stores.qdrant.QdrantVectorStore'). - embedding_model (
Reference[EmbeddingModel] | str): Embedding model used to vectorize queries and documents.
DocumentIndex¶
Document search index for text-based search (e.g., Elasticsearch, OpenSearch).
- type (
Literal): (No documentation available.) - endpoint (
str): URL endpoint for the search cluster (e.g., https://my-cluster.es.amazonaws.com).
Related Concepts¶
Indexes are used by search Steps and require Model configurations (especially embedding models for vector indexes). They may also reference AuthorizationProvider for secure access.