JavaScript samples for Foundry IQ (Azure AI Search)

Note

Foundry IQ (Azure AI Search) provides direct indexing and query APIs alongside higher-level knowledge source and knowledge base APIs for managed retrieval. Use the Azure portal, REST APIs, or Azure SDKs to configure these capabilities, or connect agents to knowledge bases in the Microsoft Foundry portal.

Learn about JavaScript code samples that demonstrate the functionality and workflow of a Foundry IQ (Azure AI Search) solution. These samples use the Azure AI Search client library for the Azure SDK for JavaScript, which you can explore through the following links.

Target Link
Package download www.npmjs.com/package/@azure/search-documents
API reference @azure/search-documents
API test cases github.com/Azure/azure-sdk-for-js/tree/main/sdk/search/search-documents/test
Source code github.com/Azure/azure-sdk-for-js/tree/main/sdk/search/search-documents
Change log github.com/Azure/azure-sdk-for-js/blob/main/sdk/search/search-documents/CHANGELOG.md

SDK samples

Code samples from the Azure SDK development team demonstrate API usage. You can find these samples in Azure/azure-sdk-for-js/tree/main/sdk/search/search-documents/samples on GitHub.

JavaScript samples

Sample Description
indexes Create, update, get, list, and delete indexes. This sample category also includes a service statistic sample.
indexers Create, update, get, list, reset, and delete indexers.
dataSourceConnections (for indexers) Create, update, get, list, and delete data source connections, which are required for indexer-based indexing of supported data sources.
skillsets Create, update, get, list, and delete skillsets that are attached to indexers and perform AI-based enrichment during indexing.
synonymMaps Create, update, get, list, and delete synonym maps.
vectorSearch Index vectors and send a vector query.

TypeScript samples

Sample Description
indexes Create, update, get, list, and delete indexes. This sample category also includes a service statistic sample.
indexers Create, update, get, list, reset, and delete indexers.
dataSourceConnections (for indexers) Create, update, get, list, and delete data source connections, which are required for indexer-based indexing of supported data sources.
skillsets Create, update, get, list, and delete skillsets that are attached to indexers and perform AI-based enrichment during indexing.
synonymMaps Create, update, get, list, and delete synonym maps.
vectorSearch Create, update, get, list, and delete vector search.

Doc samples

Code samples from the Foundry IQ team demonstrate features and workflows. The following samples are referenced in tutorials, quickstarts, and how-to articles. You can find these samples in Azure-Samples/azure-search-javascript-samples on GitHub.

JavaScript samples

Sample Article Description
quickstart-keyword-search Quickstart: Full-text search Create, load, and query a search index using sample data.
quickstart-semantic-ranking-js Quickstart: Semantic ranking Add semantic ranking to an index schema and run semantic queries.
quickstart-vector-js Quickstart: Vector search Index and query vector content.

TypeScript samples

Sample Article Description
quickstart-semantic-ranking-ts Quickstart: Semantic ranking Add semantic ranking to an index schema and run semantic queries.
quickstart-vector-ts Quickstart: Vector search Index and query vector content.

Other samples

The following samples are also published by the Foundry IQ team but aren't referenced in documentation. Associated README files provide usage instructions.

Sample Description
azure-search-classic-rag Single-shot RAG using the classic search engine as grounding data from Foundry IQ, with a chat completion model from Azure OpenAI.
azure-search-vector-sample.js JavaScript example of how to perform vector search.
azure-function-search JavaScript example of an Azure function that sends queries to a Foundry IQ service. You can substitute this JavaScript version for the api code used in Add search to web sites with .NET.
bulk-insert JavaScript example of how to use the push APIs to upload and index documents.

Tip

Use the samples browser to search for Microsoft code samples on GitHub. You can filter your search by product, service, and language.