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 > >