Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Practices to update/add/remove fields for an Azure Search Index

I was wondering if there any good resources for best practices to deal with changes (Add/remove fields from search index) to your search index without taking your Azure search service and index down. Do we need to create a completely new index and indexer to do that? I discovered that the Azure portal currently lets you add new fields to your index but what about updating/deleting fields from your search index.

Thanks!

like image 703
Zekokhan Avatar asked May 02 '18 18:05

Zekokhan


People also ask

Which policy would you choose to ensure that items are deleted from the search index as well?

Soft delete strategy using custom metadata This method uses custom metadata to indicate whether a search document should be removed from the index.

What is index and indexer in Azure search?

An indexer in Azure Cognitive Search is a crawler that extracts searchable content from cloud data sources and populates a search index using field-to-field mappings between source data and a search index.


1 Answers

If you add a field there is no strict requirement on rebuild. Existing indexed documents are given a null value for the new field. On a future re-index, values from source data are added to documents.

While you can't directly delete a field from an Azure Search index, you can achieve the same effect without rebuilding the index by having your application simply ignore the "deleted" field. If you use this approach, a deleted field isn't used, but physically the field definition and contents remain in the index until the next time you rebuild your index.

Changing a field definition requires you to rebuild your index, with the exception of changing these index attributes: Retrievable, SearchAnalyzer, SynonymMaps. You can add the Retrievable, SearchAnalyzer, and SynonymMaps attributes to an existing field or change their values without having to rebuild the index.

like image 132
Luis Cabrera Avatar answered Nov 15 '22 09:11

Luis Cabrera