Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Adding new field to the schema.xml

Solved Go to solution
Highlighted

Adding new field to the schema.xml

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

Accepted Solutions

Re: Adding new field to the schema.xml

Super Collaborator
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
1 REPLY 1

Re: Adding new field to the schema.xml

Super Collaborator
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
Don't have an account?
Coming from Hortonworks? Activate your account here