LlamaIndex Vector Store: Azure AI Search

raw JSON →
0.5.0 verified Mon Apr 27 auth: no python

Integration between LlamaIndex and Azure AI Search (formerly Azure Cognitive Search) for vector storage and hybrid search. Current version: 0.5.0. Released as part of the LlamaIndex plugin ecosystem; updates generally follow the LlamaIndex core release cadence.

pip install llama-index-vector-stores-azureaisearch
error ImportError: cannot import name 'AzureAISearchVectorStore' from 'llama_index.vector_stores'
cause Wrong import path: the class is in a submodule, not directly in vector_stores.
fix
Use 'from llama_index.vector_stores.azureaisearch import AzureAISearchVectorStore'.
error azure.core.exceptions.ServiceRequestError: ... The request failed due to connection failure
cause Azure AI Search endpoint is unreachable or credentials are missing/incorrect.
fix
Verify AZURE_SEARCH_ENDPOINT environment variable and that DefaultAzureCredential is configured.
error azure.core.exceptions.HttpResponseError: (InvalidRequest) ... The request is invalid.
cause Index schema mismatch (e.g., missing vector configuration or field type).
fix
Check that the Azure AI Search index has a vector field with correct dimensionality and HNSW configuration.
breaking Breaking change in 0.4.0: `index_name` is no longer inferred from other parameters; must be explicitly provided.
fix Always pass `index_name` when constructing AzureAISearchVectorStore.
deprecated The `search_or_index_endpoint` parameter is deprecated in favor of `search_service_endpoint` and `index_name` combination (some versions). Check current docs.
fix Use `search_service_endpoint` and `index_name` individually if required.
gotcha DefaultAzureCredential fails in non-Azure environments (local dev) unless environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET are set.
fix Use AzureCliCredential or EnvironmentCredential with explicit environment variables for local testing.
gotcha Embedding dimensionality must match the Azure AI Search index field definition. Mismatch causes silent query errors.
fix Ensure `embedding_dimensionality` matches the index schema (e.g., 1536 for text-embedding-ada-002).

Minimal setup to create an AzureAISearchVectorStore using DefaultAzureCredential.

import os
from llama_index.vector_stores.azureaisearch import AzureAISearchVectorStore
from azure.identity import DefaultAzureCredential

# Use environment variables for credentials
endpoint = os.environ.get('AZURE_SEARCH_ENDPOINT', 'https://mysearch.search.windows.net')
credential = DefaultAzureCredential()

vector_store = AzureAISearchVectorStore(
    search_or_index_endpoint=endpoint,
    credential=credential,
    index_name='my-index',
    embedding_dimensionality=1536
)
# Then integrate with LlamaIndex StorageContext