1

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?

Labo29
  • 117
  • 3
  • 13
  • Have you optimized your index after deleting documents? Deleted documents aren't expunged before after the index is rewritten to disk – MatsLindh Feb 14 '19 at 21:52
  • @MatsLindh, yes I deleted all those documents with "type:documentType" from documents section, and then optimized the core from core admin.. Is there another way to purge this unwanted field? (I cannot recreate the core, I have to keep other documents in the core ) – Labo29 Feb 14 '19 at 22:01

1 Answers1

2

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

Chris
  • 72
  • 1
  • 8
  • In the end I was not able to reindex existing fields with correct type. So, instead of creating a new core I decided to delete existing wrong documents and to re-index all these documents with a different field type and different field names. In this way existing and correct data is not touched. I will accept your answer because the other possible solution ( without changing fields name) was to build a new fresh index. – Labo29 Feb 19 '19 at 15:43