Rebuilding Sitecore 8 Analytics Indexes

Hello Readers ,

As I continue to explore my learnings with Sitecore 8, The topic for todays post is about “how to rebuild sitecore analytics indexes”.

Quickly you might ask me, why can’t we just use the Indexing Manager to rebuild Analytics Indexes, Well If you take a look at the below image you can clearly see that the analytics index is missing from the list and it is on purpose because if you take a look at the Sitecore.ContentSearch.Lucene.Index.Analytics.config file inside your include folder the index is specified as part of the group experience and hence it is excluded.


What data is stored in Analytics Index

The indexes contains data from the collection(MongoDB) and reporting(a.k.a Analytics) databases which is used in applications such as Engagement Analytics reports and the Executive Insight Dashboard. This data contains mostly information about tracking data about visitors such as online visits,contacts (visitors),personalization,goals, campaigns, profiles,pattern cards and multivariate tests.

Why do we need to rebuild Analytics Index

One of the primary reasons is that if the data in the indexes is out of sync or corrupted, However there are some other benefits too such as :

  • Reporting Application in sitecore such as Executive Dashboard / Engagement Analytics shows stale or No data
  • Experience Optimization dashboard shows incorrect multivariate test data
  • if data in the collection database (Mongodb) has changed and has become out of sync. For example,classification of contact or locations.

Finally, Step by Step Instructions on Rebuilding Analytics Databases

  • Attach a clean analytics database to your SQL Server and name it Analytics_secondary
  • Open your connectionstrings.config file and add a reference to you secondary analytics database

    [code language=”xml”]
    <add name="reporting" connectionString="user id=sa;password=12345;Data Source=.\SQLServer;Database=Analytics" />
    <add name="reporting.secondary" connectionString="user id=sa;password=12345;Data Source=.\SQLServer;Database=Analytics_Secondary" />

  • The Sitecore Analytics Index Rebuilding is triggered when you aggregate visitors data. So to trigger index rebuild, you need to trigger reporting db rebuilding. Navigate to this page http://{your_site}/sitecore/admin/RebuildReportingDB.aspx
  • click on Start and the rebuild should get started
  • Once the rebuild completes , you should see the below messageAfterRebuild
  • Finally Open your connectionstrings.config file, Rename your reporting.secondary name to reporting, since your newly rebuilt secondary database is your reporting database and comment out the original reporting connections string

    [code language=”xml”]
    <!–<add name="reporting" connectionString="user id=sa;password=12345;Data Source=.\SQLServer;Database=Analytics" /> –>
    <add name="reporting" connectionString="user id=sa;password=12345;Data Source=.\SQLServer;Database=Analytics_Secondary" />

Good Reads