Insights

Sitecore Marketing Definition Missing

How to fix the error message indicating the sitecore_marketingdefitions_master index was not found.

If you've been working with Sitecore 9+, on Solr, and been using xDB or EXM or even on a Standalone instance and enabled or disabled xDB recently, then it's likely (though not guaranteed) that you've encountered an error message indicating the sitecore_marketingdefitions_master index was not found.

What does the error look like? Glad you asked. Depending on your level of exception gathering, you may not see it until you look in your log files, or you may see that dreadful yellow error screen. In any case, the error message typically resembles the following:

Exception Details: Sitecore.ContentSearch.Exceptions.IndexNotFoundException: Index sitecore_marketingdefinitions_master was not found
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin
and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[IndexNotFoundException: Index sitecore_marketingdefinitions_master was not found] Sitecore.ContentSearch.ContentSearchManager.GetIndex(String name) +127

This is an error that can cause some anxiety especially when it shows up after what may have seemed like an innocuous change. It's also an error that can go away if you refresh your browser a few times. However, while that may work, it's not going to stop the error from reoccurring.

How To Fix It?

It turns out, the simplest solution is adding a patch file with the tag <initializeOnAdd>true</initializeOnAdd> to the <marketingDefinitionSolrIndexConfiguration> section.

What does that patch file look like exactly? Glad you asked. Below you'll find one we have used recently. Just store it in your App_Config/include directory and your problem should go away. Note that depending on your environment, you may need to make adjustments to the role attribute if you've modified yours accordingly.


<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:search="http://www.sitecore.net/xmlconfig/search/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
  <sitecore role:require="Standalone or ContentDelivery or ContentManagement" search:require="solr">
    <marketingDefinitionSearch>
      <indexConfigurations>
        <marketingDefinitionSolrIndexConfiguration>
          <initializeOnAdd patch:before="fieldMap">true</initializeOnAdd>
        </marketingDefinitionSolrIndexConfiguration>
      </indexConfigurations>
    </marketingDefinitionSearch>
  </sitecore>
</configuration>

In The End...

While a lot of the out-of-the-blue errors that appear with Sitecore, may seem like mountains to overcome, many of them are easily solvable. Some as simple as with a patch file. We hope this solution finds you well.

Hey, Developers!

We're on the look out for talented developers to join our team.

Think you have what it takes?

Meet David Austin

Development Team Lead

📷🕹️👪

David is a decorated Development Team Lead with Sitecore Technology MVP and Coveo MVP awards, as well as Sitecore CDP & Personalize Certified. He's worked in IT for 25 years; everything ranging from Developer to Business Analyst to Group Lead helping manage everything from Intranet and Internet sites to facility management and application support. David is a dedicated family man who loves to spend time with his girls. He's also an avid photographer and loves to explore new places.

Connect with David