Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Learn about 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 |
| 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 Azure AI Search 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 | Quickstart: Full-text search | Create, load, and query a search index using sample data. |
| quickstart-rag-js | Quickstart: Generative search (RAG) | Use grounding data from Azure AI Search with a chat completion model from Azure OpenAI. |
| 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-rag-ts | Quickstart: Generative search (RAG) | Use grounding data from Azure AI Search with a chat completion model from Azure OpenAI. |
| 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 Azure AI Search team but aren't referenced in documentation. Associated README files provide usage instructions.
| Sample | Description |
|---|---|
| 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 search 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.