Cannot Change DocValues Type

Errors

The Error

You changed a field definition in your schema and now Solr throws:

java.lang.IllegalArgumentException: cannot change DocValues type
from SORTED to SORTED_SET for field "your_field_name"

This means the index on disk was built with one DocValues type, but your updated schema now demands a different one. Solr cannot convert between them on the fly.


What Are DocValues? (The Simple Version)

Imagine a library with two card catalogs:

  • The regular index (inverted index) is organized by word — you look up a word and it tells you which books contain it. Great for searching.
  • DocValues is organized by book — you look up a book and it instantly tells you its author, date, price. Great for sorting, faceting, and grouping.

When you change how a field is defined (like switching from single-valued to multi-valued), the "book catalog" format changes. But the old catalog is already built — Solr cannot just rearrange it.

HOW SOLR PICKS THE DOCVALUES TYPEString / UUID Field(StrField, UUIDField)single-valued= SORTEDmulti-valued= SORTED_SETPoint Numeric / Date Field(IntPointField, DatePointField, etc.)single-valued= NUMERICmulti-valued= SORTED_NUMERICChanging multiValued or field type = DocValues type change = ERROROld index segments still have the old type. They cannot be converted in place.The fix: reset your index and re-index all your data.


Common Triggers

What You Changed DocValues Change Error
multiValued="false" to "true" on a string field SORTED → SORTED_SET Yes
multiValued="true" to "false" on a string field SORTED_SET → SORTED Yes
Field type from string to pint SORTED → NUMERIC Yes
Added docValues="true" to existing field None → new type Yes
Changed from Trie field to Point field May change type Yes

How to Fix It

Solution 1: Reset and Re-Index (Recommended)

The only clean fix is to clear the old index data and rebuild it with the new schema:

  1. Go to your Opensolr Index Control Panel
  2. Reset your index (remove all indexed data)
  3. Reload the Opensolr Index so Solr picks up the new schema
  4. Re-index all your data from your application

This gives Solr a fresh start with the correct DocValues type from the beginning.

Solution 2: Create a New Index

If resetting does not work (rare edge cases with deeply corrupted segments), create a new Opensolr Index, upload your schema, and re-index your data into the new index.


How to Avoid This in the Future

  • Plan your schema carefully before indexing large amounts of data
  • If you need to change multiValued or field types, know that a full re-index is required
  • Test schema changes on a small test index first before applying them to production

Quick Checklist

  • Check your schema change — did you change multiValued, type, or docValues?
  • Reset your index from the Opensolr control panel
  • Reload the Opensolr Index
  • Re-index all data from your application
  • If using Drupal, update the server connection settings if you created a new index

Need help with a schema migration? Reach out to us at support@opensolr.com — we can help you plan the transition.