SearchStax Help Center


Cannot Change DocValues Type

SearchStax Managed Search service clients sometimes ask about the following Solr indexing error:

java.lang.IllegalArgumentException: cannot change DocValues type from <type> to <other_type> for field <fieldName>

The Solr Schema explains DocValues in this way:

DocValues is recommended (required, if you are using *Point fields) for faceting, grouping, sorting and function queries. DocValues will make the index faster to load, more NRT-friendly and more memory-efficient. [DocValues are] currently only supported by StrField, UUIDField, all *PointFields, and depending on the field type, they might require the field to be single-valued, be required or have a default value.

DocValues is set in many schema fields similar to this one:

<field name="date" type="pdate" docValues="true" indexed="true" stored="true" multiValued="false" /> 

The DocValues type is determined internally by Solr in the following way:

DocValues are only available for specific field types. The types chosen determine the underlying Lucene docValue type that will be used. The available Solr field types are:

  • StrField and UUIDField.
    • If the field is single-valued (i.e., multi-valued is false), Lucene will use the SORTED type.
    • If the field is multi-valued, Lucene will use the SORTED_SET type.
  • Any Trie* numeric fields, date fields and EnumField.
    • If the field is single-valued (i.e., multi-valued is false), Lucene will use the NUMERIC type.
    • If the field is multi-valued, Lucene will use the SORTED_SET type.
  • Boolean fields
  • Int|Long|Float|Double|Date PointField
    • If the field is single-valued (i.e., multi-valued is false), Lucene will use the NUMERIC type.
    • If the field is multi-valued, Lucene will use the SORTED_NUMERIC type.

From the above, you can see that Solr’s complaint that it “cannot change a DocValues type” implies that someone has changed the definition of the named field, probably by altering the DocValues setting or by changing the multivalue setting.

A field change requires you to discard and regenerate the index. Otherwise, the conflict between schema and index will cause many downstream error messages.

Try recreating the index followed by a rolling restart. Otherwise contact SearchStax Support. A corrupt index replica might have to be manually removed and regenerated.

Questions?

Do not hesitate to contact the SearchStax Support Desk.


Return to Frequently Asked Questions.