Sitecore Azure: Request size exceeded Azure Search Service limits

Azure Search with Sitecore is a great alternative to SOLR, especially if you are working with an Azure environment.  I have found it simple to setup, especially in Sitecore 9 with the single configuration property to switch between SOLR, Lucene, and Azure.  Once you have created your resource, and configured your connection strings it is basically plug and play.  Any new indexes you present in your configuration will be dynamically built in your azure resource.

The one area that SOLR greatly exceeds Azure search is in the time it takes to build the index.  It is painfully slow.  Even more so if you are getting the error “Request size exceeded the Azure Search Service limits”, which will  not only cause a ton of lag in your index but also lead to missing data.

By default Sitecore is configured to gather 1,000 documents and send them through a REST service call to Azure Search.  In my specific scenario I was attempting to index article items with a body content field that ranged in size from a couple paragraphs to several pages of content.  When enough of the larger sized articles were grouped in one of the requests sent to the Azure Search service, this was causing a lag followed by the above mentioned error in the logs.

Fortunately there is a super easy fix that seems to get things moving along quiet well.  Add the following patch configuration to your solution:

<configuration xmlns:patch=” ” >
<cloudBatchBuilder type=”Sitecore.ContentSearch.Azure.CloudBatchBuilder, Sitecore.ContentSearch.Azure”>

Reducing Max Document count from 1000 to 250 did the trick for me.  All errors were removed, as well as a huge decrease in index time.  Indexes that were taking well over an hour to rebuild were now taking under 10 minutes to complete.

There is still plenty to be desired when it comes to index rebuild time on Azure search versus SOLR, but if you find yourself with a really slooooow index build time then most certainly consider reducing the maxDocuments property.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s