Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

AzureDocumentDBFullTextRetriever

Retrieve documents from an AzureDocumentDBDocumentStore using BM25 full-text search. This component is useful for keyword-based retrieval pipelines that rely on lexical matching rather than dense vector similarity. Azure DocumentDB is Azure Cosmos DB for MongoDB (vCore), so this component is also relevant if you're searching for "Cosmos DB" or "vCore".

note

Full-text search in Azure DocumentDB is currently a gated preview and must be enabled on the cluster before using this retriever. You must also configure a full_text_search_index on the document store.

Key Features​

  • Performs BM25 full-text search using Azure DocumentDB's gated-preview text search capability.
  • Accepts a single query string or a list of query strings.
  • Supports optional fuzzy matching with configurable maxEdits for typo tolerance.
  • Configurable filter policy to merge or replace filters at query time.
  • Supports both synchronous and asynchronous execution.

Configuration​

Add Workspace-Level Integration​

  1. Click your profile icon and choose Settings.
  2. Go to Workspace>Integrations.
  3. Find the provider you want to connect and click Connect next to them.
  4. Enter the API key and any other required details.
  5. Click Connect. You can use this integration in pipelines and indexes in the current workspace.

Add Organization-Level Integration​

  1. Click your profile icon and choose Settings.
  2. Go to Organization>Integrations.
  3. Find the provider you want to connect and click Connect next to them.
  4. Enter the API key and any other required details.
  5. Click Connect. You can use this integration in pipelines and indexes in all workspaces in the current organization.
  1. Make sure full-text search is enabled on your Azure DocumentDB cluster (gated preview).
  2. Set the AZURE_DOCUMENTDB_CLUSTER_NAME environment variable with your cluster name, or provide a mongo_connection_string for local development.
  3. Configure an AzureDocumentDBDocumentStore with a full_text_search_index pointing to your text search index.
  4. Drag the AzureDocumentDBFullTextRetriever component onto the canvas from the Component Library.
  5. Connect the retriever output to downstream components such as PromptBuilder.

Connections​

AzureDocumentDBFullTextRetriever receives a query string (or list of strings) as input. It outputs a list of Document objects ranked by BM25 relevance that you can connect to PromptBuilder or other downstream components.

Source Code​

To check this component's source code, open full_text_retriever.py in the Haystack Core Integrations repository.

Usage Examples​

Basic Configuration​

AzureDocumentDBFullTextRetriever:
type: haystack_integrations.components.retrievers.azure_documentdb.full_text_retriever.AzureDocumentDBFullTextRetriever
init_parameters:
document_store: AzureDocumentDBDocumentStore
top_k: 5

Using the Component in a Pipeline​

# haystack-pipeline
components:
document_store:
type: haystack_integrations.document_stores.azure_documentdb.document_store.AzureDocumentDBDocumentStore
init_parameters:
database_name: haystack
collection_name: documents
full_text_search_index: haystack_fts_index

retriever:
type: haystack_integrations.components.retrievers.azure_documentdb.full_text_retriever.AzureDocumentDBFullTextRetriever
init_parameters:
document_store: document_store
top_k: 5

inputs:
query:
- retriever.query

outputs:
documents: retriever.documents

Parameters​

Inputs​

ParameterTypeDescription
querystr | List[str]The keyword query string or list of strings to search for.
fuzzyOptional[Dict[str, int]]Azure DocumentDB fuzzy search options, for example {"maxEdits": 1} for typo tolerance.
filtersOptional[Dict[str, Any]]Filters to apply when retrieving documents.
top_kOptional[int]The maximum number of documents to retrieve. Overrides the init-time value.

Outputs​

ParameterTypeDescription
documentsList[Document]A list of documents ranked by BM25 relevance from the document store.

Init Parameters​

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
document_storeAzureDocumentDBDocumentStoreThe Azure DocumentDB document store to retrieve documents from. Requires full_text_search_index to be set.
filtersOptional[Dict[str, Any]]NoneDefault filters to apply when retrieving documents.
top_kint10The maximum number of documents to retrieve.
filter_policyFilterPolicyFilterPolicy.REPLACEHow to handle filters passed at query time. REPLACE replaces init-time filters; MERGE combines them.

Run Method Parameters​

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
querystr | List[str]The keyword query string or list of strings.
fuzzyOptional[Dict[str, int]]NoneFuzzy search options such as {"maxEdits": 1}.
filtersOptional[Dict[str, Any]]NoneRuntime filters to apply.
top_kOptional[int]NoneMaximum number of documents to retrieve. Overrides the init-time value.