JavaScript samples for Azure AI Search

Learn about the JavaScript code samples that demonstrate the functionality and workflow of an 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

SDK samples

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

JavaScript SDK samples

Samples Description
indexes Demonstrates how to create, update, get, list, and delete search indexes. This sample category also includes a service statistic sample.
dataSourceConnections (for indexers) Demonstrates how to create, update, get, list, and delete indexer data sources, required for indexer-based indexing of supported Azure data sources.
indexers Demonstrates how to create, update, get, list, reset, and delete indexers.
skillSet Demonstrates how to create, update, get, list, and delete skillsets that are attached indexers, and that perform AI-based enrichment during indexing.
synonymMaps Demonstrates how to create, update, get, list, and delete synonym maps.
VectorSearch Demonstrates how to index vectors and send a vector query.

TypeScript samples

Samples Description
indexes Demonstrates how to create, update, get, list, and delete search indexes. This sample category also includes a service statistic sample.
dataSourceConnections (for indexers) Demonstrates how to create, update, get, list, and delete indexer data sources, required for indexer-based indexing of supported Azure data sources.
indexers Demonstrates how to create, update, get, list, reset, and delete indexers.
skillSet Demonstrates how to create, update, get, list, and delete skillsets that are attached indexers, and that perform AI-based enrichment during indexing.
synonymMaps Demonstrates how to create, update, get, list, and delete synonym maps.
VectorSearch Demonstrates how to index vectors and send a vector query.

Doc samples

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

Samples Article
quickstart Source code for the JavaScript portion of Quickstart: Full text search using the Azure SDKs. Covers the basic workflow for creating, loading, and querying a search index using sample data.
search-website Source code for Tutorial: Add search to web apps. Demonstrates an end-to-end search app that includes a rich client plus components for hosting the app and handling search requests.

Tip

Try the Samples browser to search for Microsoft code samples in GitHub, filtered by product, service, and language.

Other samples

The following samples are also published by the Azure AI Search team, but aren't referenced in documentation. Associated readme files provide usage instructions.

Samples Description
azure-search-vector-sample.js Vector search sample using the Azure SDK for JavaScript
azure-search-react-template React template for Azure AI Search (github.com)