Support Questions

Find answers, ask questions, and share your expertise

Adding new field to the schema.xml

avatar
Expert Contributor

I like to add new field to the existing document which have 1 million records.

 

I doesn't want to lose the exiting documents.

 

sample exiting doucment:

 

id : 123

field1 : 'sample1'      ---------------- indexed

filed2 : 'sample 2'    -------------------- stored

 

Now I want to add new field to the schema.xml which is only stored attribute and its not need to be indexed.

 

<field name="field3" type="string" indexed="false" stored="true" required="false" multiValued="false"/>

 

I know like this can be achived with the solrctl reload option.

 

But my doubt is after adding new field. is it neccessary to reindex whole documents?

 

what is reindex?

My understanding is again I have to load data to solr.and I don't have backup of these data anywhere

 

please help me on this

 

Thanks in advance.

1 ACCEPTED SOLUTION

avatar
You shouldn't have to reindex the whole set of documents, unless you need that new field to be added to those existing documents. New documents that have that field would be searchable with that field, but older documents would not be returned.

Reindexing would consist of removing the existing documents in the solr collection, and re running your indexing application (MRIT, solrj etc) to index all the original documents again. Alternatively you could have a solrj application that reads the old documents and adds the value to the document for the newly created field.

Of course, you should test this in a QA environment to confirm the desired behavior.
-pd

View solution in original post

1 REPLY 1

avatar
You shouldn't have to reindex the whole set of documents, unless you need that new field to be added to those existing documents. New documents that have that field would be searchable with that field, but older documents would not be returned.

Reindexing would consist of removing the existing documents in the solr collection, and re running your indexing application (MRIT, solrj etc) to index all the original documents again. Alternatively you could have a solrj application that reads the old documents and adds the value to the document for the newly created field.

Of course, you should test this in a QA environment to confirm the desired behavior.
-pd