Search code examples
solrschemasolrcloudreindex

Reindexing Solr Data with different field type


I am facing an issue while reindexing Solr data.

I have indexed some documents specifying a wrong field type on the managed-schema file. Now, instead of the wrong field definition, I would like to use:

<field name="documentDate" type="date" indexed="true" stored="true"/> 

To do this I have:

  • deleted all the previous wrong indexed documents;
  • updated the managed-schema
  • reloaded the core

After these steps I tried to reindex documents, but this fails; looking at logs:

org.apache.solr.common.SolrException: Exception writing document id 2ecde3eb2b5964b2c44362f752f7b90d to the index; possible analysis error: cannot change DocValues type from NUMERIC to SORTED_SET for field "documentDate".

How is this possible? I have removed all the documents storing the field documentDate.. How can I solve this issue?


Solution

  • maybe try to delete the data folder in your core. You can add new fields to your schema without delete the data folder, but when you modify a field (this is my experience) then I have to delete the data folder and build a new fresh index