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