Search code examples
securityindexingsolrluceneupdating

Solr's schema change without loosing data and without using dynamic fields


I want to do this all:

  1. I want to add more fields into same Solr's schema for my new document's index.
  2. I don't want to loose my old indexes stored in the same Solr Shards.

I don't know solution to this respecting following constraints:

  1. I don't want to use dynamic fields as I don't want any indexed-documents should have fields that I am not aware about (because the index can also be posted by other Solr-users and I want restriction on what fields they can add).

Is there any solution ? If yes, then what is the solution.


Solution

  • Yes you can do it. Just add the new fields in schema(not necessarily dynamic) and index the new document to Solr. As Andrea mentioned the its just the old documents wouldn't have the newly inserted fields.

    NOTE: Do not make the newly added fields as "required = true" which would corrupt the existing index.