Blog Post

AI - Azure AI services Blog
1 MIN READ

Azure Cognitive Search now supports swapping indexes

DerekLegenzoff's avatar
Jun 30, 2022

Search indexes are immutable, which means if you need to update your index, you’ll often need to drop and rebuild your index or create a new index and then migrate your application over. Swapping search indexes like this adds complexity to managing a search index and can be difficult if you end up needing to update application settings in multiple places or if you need to redeploy your code.

 

To help make swapping indexes easier, Azure Cognitive Search now supports index aliases, available in preview. An alias is a secondary name that can be used to reference an index for querying, indexing, and other document operations. You can create aliases via the REST API, Visual Studio Code extension, or the SDK.

 

POST https://[service name].search.windows.net/aliases?api-version=2021-04-30-Preview

{
"name": "my-alias",
"indexes": ["hotel-samples-index"]
}

 

If you find yourself updating your search indexes fairly frequently, you’ll probably benefit from using aliases. The diagram below shows the typical workflow for using index aliases with your application.

Figure 1. The workflow for using an index alias with your application

Index aliases are supported by all document operations which include the following APIs:

 

To get started, check out our documentation on how to create an index alias.

Updated Jul 18, 2023
Version 3.0