Using LangChain's AzureAISearchVectorStore with Existing Azure AI Search Indexes

LangChain’s AzureAISearchVectorStore expects specific field names (content, content_vector) that don’t match Azure AI Search’s default field names (content_text, content_embedding). Here’s how to bridge the gap.

The Problem

AzureAISearchVectorStore provides excellent support for hybrid and semantic queries against Azure AI Search. However, when connecting to an existing Azure AI Search index, it doesn’t work out of the box.

The issue is a field name mismatch:

LangChain Expects Azure AI Search Creates
content content_text
content_vector content_embedding

LangChain hardcodes these field names internally, and currently there’s no configuration option to customize them.

The Solution

Add output field mappings to your indexer configuration to map Azure’s field names to what LangChain expects:

Then configure the vector store:

Feature Request

It would be helpful if AzureAISearchVectorStore supported custom field name mappings in the configuration, similar to how other vector stores handle this. This would eliminate the need for indexer-level workarounds.

Hey @g-abani :waving_hand: this is a great request. Would you mind raising an issue in GitHub? We would appreciate any types of contributions here.

Sure @christian-bromann

hi @christian-bromann I have created an issue for the above [0]. I have added the label as bug, didn’t get an option to remove that as this look to be a feature request. I have also got the fix for it which I have verified in my local, after building and referring langchain-community lib in my local. Please let me know if I can contribute to fix this issue.

[0]- [Feature Request] Add custom field mapping support to AzureAISearchVectorStore · Issue #9689 · langchain-ai/langchainjs · GitHub

hi @christian-bromann can you please let me know your thoughts on this.