Check the attached thread. It might be what you're looking for.

On Tue, Aug 31, 2021 at 4:30 PM Ed Yu <eky...@hotmail.com> wrote:

> We have a solr setup from a very old version (1.4) and we are upgrading it
> to 8.9. We are stuck at the point that I think the schema.xml is
> syntactically free of errors but now giving an error:
>
> Caused by: org.apache.solr.common.SolrException: Could not load conf for
> core nwr_col: Can't load schema /var/solr/data/nwr_col/conf/schema.xml:
> _root_ field must be defined using the exact same fieldType as the
> uniqueKey field (id) uses: uuid
>
> We have a field “id”
>    <field name="id" type="uuid" indexed="true" stored="true"
> default="NEW"/>
>    <fieldType name="uuid" class="solr.UUIDField" indexed="true"/>
>
> So I added:
>
>    <field name="_root_" type="uuid" indexed="false" stored="false"
> docValues="false" default="NEW" />
>
> And now I got the following error:
>
> Caused by: org.apache.solr.common.SolrException: Could not load conf for
> core nwr_col: Can't load schema /var/solr/data/nwr_col/conf/schema.xml:
> [schema.xml] Duplicate field definition for '_root_'
> [[[_root_{type=string,properties=indexed,omitNorms,omitTermFreqAndPositions,sortMissingLast,docValues,useDocValuesAsStored,uninvertible}]]]
> and [[[_root_{type=uuid,default=NEW,properties=useDocValuesAsStored}]]]
>
> Sounds like redefining the _root_ field is not allowed.
>
> So I need to know:
>
>
>   1.  How can we redefine _root_ to fix the above error?
>   2.  Preferably, is there a way we can disable this parent child document
> feature to avoid the need of the _root_ field?
>
> Sorry for such a noob question.
>
> Regards,
> Ed.
>
> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
>
>
--- Begin Message ---
The follow-up here from JIRA is that, as of Solr 8.0, you must not add "_root_" 
to a schema for an existing collection.  Solr uses this field instead of the 
uniqueKey for certain identity checks.  Chaos will ensue if you add it later.  
I shall update the ref guide to add a warning.

~ David

On 2021/06/08 15:14:18, Andreas Hubold <andreas.hub...@coremedia.com> wrote: 
> Hi,
> 
> with Solr 8.6.3 we developed a new feature that uses partial update to 
> add some nested documents to existing index documents.
> 
> Because we didn't have nested documents so far, we've added the _root_ 
> and _nest_path_ fields to the schema, but of course these were unset for 
> existing documents.
> 
> <field name="_root_" type="string" indexed="true" stored="false" 
> docValues="true" />
> <field name="_nest_path_" type="_nest_path_" /><fieldType 
> name="_nest_path_" class="solr.NestPathField" />
> 
> With 8.6.3 it worked fine to use partial updates to set some nested 
> documents to existing docs. Nested documents itself were never changed 
> here, we're just setting the nested documents for existing top-level 
> documents.
> 
> I could also see that the _root_ field was correctly updated for both 
> root and child documents.
> 
> Now we've updated to Solr 8.8.2 and still want to use old indices where 
> the _root_ field isn't set for all documents. But now adding nested 
> documents doesn't work anymore:
> 
> Caused by: org.apache.solr.common.SolrException: Attempted an 
> atomic/partial update to a child doc without indicating the _root_ somehow.
>          at 
> org.apache.solr.handler.component.RealTimeGetComponent.getInputDocument(RealTimeGetComponent.java:746)
>          at 
> org.apache.solr.update.processor.DistributedUpdateProcessor.getUpdatedDocument(DistributedUpdateProcessor.java:689)
>          at 
> org.apache.solr.update.processor.DistributedUpdateProcessor.doVersionAdd(DistributedUpdateProcessor.java:373)
>          at 
> org.apache.solr.update.processor.DistributedUpdateProcessor.lambda$versionAdd$0(DistributedUpdateProcessor.java:336)
>          at 
> org.apache.solr.update.VersionBucket.runWithLock(VersionBucket.java:50)
>          at 
> org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:336)
>          at 
> org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:222)
>          at 
> org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55)
> 
> This check was introduced with 
> https://issues.apache.org/jira/browse/SOLR-14923
> 
> I know, I could reindex everything, but I'd really really like to avoid 
> this.
> Is there some other kind of workaround that I could use with Solr 8.8.2?
> 
> Or would it be possible to change the check, so that it only throws an 
> exception if there's an existing(!) _root_ value in the indexed document 
> that doesn't match?
> 
> Thanks,
> Andreas
> 
> 

--- End Message ---

Reply via email to