Azure Cognitive Search now supports swapping indexes

Published Jun 30 2022 04:59 PM 1,887 Views
Microsoft

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 applicationFigure 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.

Co-Authors
Version history
Last update:
‎Jun 30 2022 04:58 PM
Updated by: