We are using Azure Search for a custom index and I have SwitchOnRebuild enabled in my config patch.
<!-- USE SWITCHONREBUILD Determines if Azure Search provider uses SwitchOnRebuild() function to avoid Search functionality downtime during index rebuild. Each time you do a full index rebuild, this rebuild take place in the secondary index. The secondary index becomes the primary one after the rebuild Default value: true --> <setting name="ContentSearch.Azure.SwitchOnRebuild" value="true"/>
This all seems to work quite well. As I understand it (and can see in the Azure Search Service) an second index is created with the suffix: '_secondary' at the point of rebuilding and is switched to the primary index once the rebuild is complete and the old index is deleted.
I'm wondering where Sitecore stores the name of the current/primary index in use and if this is accessible in some way?
It would be good to understand more about how the Azure Search provider is switched on each role in Azure also as there doesn't seem to be much info on this.