If you have a working index and search result and you find that it starts to get empty all of the sudden on what seems to be an interval, Sitecore is probably rebuilding the entire index for you based on a job agent.
There is a default Threshold of 100k that tells Sitecore to trigger an index rebuild after publish:end event if you’re using that type of index strategy and if you’re using <CheckForThreshold>true<CheckForThreshold>.
When an index is being rebuilt, the index is empty during the rebuild. This will cause downtime on your search and is obviously not great user experience.
This is where you should use SwitchOnRebuildIndex (Sitecore docs here). It is a recommended practice to use SwitchOnRebuildIndex when CheckForThreshold is set to true. Go to <site>/sitecore/admin/showconfig.aspx to see what you’re using if you don’t know.
It’s located under
This can become an issue if you for instance have buckets with lots of items to index. So make sure that you switch to SwitchOnRebuildIndex on your index configuration.
Create rebuild core
You need to have a rebuild core for the index you want to use SwitchOnRebuildIndex on.
- Stop your Solr Service in Services or Task Manager -> service tab
- Go to <Solr_Folder>/solr-8.8.2/server/solr and create a copy of your desired indexfolder and and add _rebuild at the end like this.

- Go into the newly created copy folder and open core.properties file. Here you change the name of the core to match the folder name with _rebuild at the end.

- Now create a patch file for your index where you change the type and add the attribute for the new core
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="custom_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
<patch:attribute name="type">Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider</patch:attribute>
<param desc="core">custom_index</param>
<param patch:after="*[@desc='core']" desc="rebuildcore">custom_index_rebuild</param>
</index>
</indexes>
</configuration>
</contentSearch>
</sitecore>
</configuration>
Done
Start up your Solr service and open Sitecore.
Now your index should switch cores when being rebuilt. The core swap will happen automatically. You can verify this in your Solr instance admin UI and see that your index “custom_index” might now be located in the “custom_index_rebuild” folder. They will switch back and forth automatically and this is expected behavior.
