Content length exceeds upload limit of 2048 KB

Errors

The Error

You are trying to index documents or upload data to Solr and get this:

ERROR: the request body sent in a POST request is too large (X bytes).
Content length exceeds upload limit of 2048 KB.

This means the data you are sending in a single request is bigger than Solr is willing to accept. The default limit is 2,048 KB (2 MB) — and your request exceeds that.


What Is Actually Happening

Solr has two safety limits that control how much data you can send in one request. Think of them as doorways — if your package is too big to fit through the door, Solr refuses it.

SOLR UPLOAD LIMITSformdataUploadLimitInKBFor data sent as form fields(POST body, JSON, XML payloads)Default: 2,048 KBmultipartUploadLimitInKBFor file uploads via multipart POST(config files, binary data)Default: 2,048,000 KBBoth are configurable in your solrconfig.xmlIncrease them to accept larger requests


How to Fix It

Step 1: Open Your solrconfig.xml

Go to your Opensolr Index Control PanelConfig Files Editor → select solrconfig.xml.

Step 2: Find the requestDispatcher

Look for this block:

<requestDispatcher handleSelect="false"
  multipartUploadLimitInKB="2048000"
  formdataUploadLimitInKB="2048" />

Step 3: Increase the Limit

Change formdataUploadLimitInKB to a higher value. For example, to allow 20 MB uploads:

<requestDispatcher handleSelect="false"
  multipartUploadLimitInKB="2048000"
  formdataUploadLimitInKB="20480" />

Step 4: Save and Reload

Save the file and click Reload in your Opensolr Index control panel.


A Better Approach: Smaller Batches

Instead of sending one massive request, consider breaking your data into smaller batches. This is more reliable and less likely to time out:

// Instead of one request with 10,000 documents:
POST /update  [10,000 docs]  ← may timeout or exceed limit

// Send 100 requests with 100 documents each:
POST /update  [100 docs]  ← fast, reliable
POST /update  [100 docs]
...
POST /update?commit=true  [100 docs]  ← commit at the end

Most Solr client libraries (SolrJ, pysolr, etc.) support batch sizing out of the box.


Related: Too Many Boolean Clauses

If you hit the upload limit on a query (not indexing), you might also run into the maxBooleanClauses limit. This happens when a single query contains hundreds of OR conditions.

If you are building large filter queries like fq=id:(val1 OR val2 OR ... OR val5000), consider splitting them into smaller queries and combining results in your application. See our FAQ on Too Many Boolean Clauses for details.


Quick Checklist

  • Increase formdataUploadLimitInKB in solrconfig.xml for larger POST bodies
  • Increase multipartUploadLimitInKB for larger file uploads
  • Consider batching your indexing requests into smaller chunks
  • Always reload your Opensolr Index after config changes
  • If queries are too large, split them into smaller requests

Need help with upload limits? Reach out to us at support@opensolr.com — we can help you find the right settings for your use case.