Skip to content

willvelida/azure-cognitive-search-getting-started-sample

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Getting started with Azure Cognitive Search in C#

Sample showcasing how to deploy an Azure Cognitive Search service using Bicep and how to work with the service in .NET. This sample accompanies my blog post on Getting started with Azure Cognitive Search in C#.

This sample showcases the following functionality:

  • Deploying an Azure Cognitive Search service in Bicep
  • Interacting with the Search service in a C# Console application, including:
    • Creating an SearchIndexClient and a SearchIndexerClient to interact with both indexes and indexers in Azure Cognitive Search.
    • Creating an index in Azure Cognitive Search.
    • Creating an indexer that pulls data from Azure Blob Storage into a Cognitive Search index.
    • Performing basic queries against Cognitive Search using .NET.

Required software

To create this sample, I used the following software and SDKs:

Deploying an running the sample

To deploy the Azure Cognitive Search resource, navigate to the deploy folder and run the following commands:

# Create the resource group
az group create --name <name-of-your-resource-group> --location <azure-region-close-to-you>

# Deploy the Bicep template
az deployment group create --resource-group <name-of-your-resource-group> --template-file .\deploy\main.bicep

Once the Bicep template has been deployed successfully, you will need to populate the appsettings.json file with the following settings to run the sample:

{
  "SearchServiceUri": "",
  "SearchServiceApiKey": "",
  "BlobStorageAccountName": "",
  "BlobStorageConnectionString": ""
}

To run the sample, navigate to the src/CognitiveSearchDemo folder and run the following:

dotnet run

About

Sample showcasing how to deploy an Azure Cognitive Search service using Bicep and how to work with the service in .NET

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published