ComponentsRetrieversAzure Cognitive SearchOn this pageAzure Cognitive SearchAzure Cognitive Search (formerly known as Azure Search) is a cloud search service that gives developers infrastructure, APIs, and tools for building a rich search experience over private, heterogeneous content in web, mobile, and enterprise applications.Search is foundational to any app that surfaces text to users, where common scenarios include catalog or document search, online retail apps, or data exploration over proprietary content. When you create a search service, you'll work with the following capabilities:A search engine for full text search over a search index containing user-owned contentRich indexing, with lexical analysis and optional AI enrichment for content extraction and transformationRich query syntax for text search, fuzzy search, autocomplete, geo-search and moreProgrammability through REST APIs and client libraries in Azure SDKsAzure integration at the data layer, machine learning layer, and AI (Cognitive Services)This notebook shows how to use Azure Cognitive Search (ACS) within LangChain.Set up Azure Cognitive Search​To set up ACS, please follow the instrcutions here.Please notethe name of your ACS service, the name of your ACS index,your API key.Your API key can be either Admin or Query key, but as we only read data it is recommended to use a Query key.Using the Azure Cognitive Search Retriever​import osfrom langchain.retrievers import AzureCognitiveSearchRetrieverSet Service Name, Index Name and API key as environment variables (alternatively, you can pass them as arguments to AzureCognitiveSearchRetriever).os.environ["AZURE_COGNITIVE_SEARCH_SERVICE_NAME"] = "<YOUR_ACS_SERVICE_NAME>"os.environ["AZURE_COGNITIVE_SEARCH_INDEX_NAME"] = "<YOUR_ACS_INDEX_NAME>"os.environ["AZURE_COGNITIVE_SEARCH_API_KEY"] = "<YOUR_API_KEY>"Create the Retrieverretriever = AzureCognitiveSearchRetriever(content_key="content", top_k=10)Now you can use retrieve documents from Azure Cognitive Searchretriever.get_relevant_documents("what is langchain")You can change the number of results returned with the top_k parameter. The default value is None, which returns all results.PreviousArxivNextBM25Set up Azure Cognitive SearchUsing the Azure Cognitive Search Retriever