Reply
Contributor
Posts: 48
Registered: ‎01-19-2017
Accepted Solution

Adding new field to the schema.xml

[ Edited ]

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.

Cloudera Employee
Posts: 199
Registered: ‎01-09-2014

Re: Adding new field to the schema.xml

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
Announcements