On 1/25/2022 9:42 AM, LaFrance, Jason wrote:
I can recreate the issue in the Solr UI by clearing the core, manually adding a document without a *_root_* field via the Documents tab twice, then querying the core and seeing the duplication with *_root_* fields in the result documents.

This is happening because you created a dynamic field named "*" ... so any field will be allowed, even those that Solr can automatically generate. I did a test where I added that dynamic field to a schema, and a document that I indexed after that DID have the _root_ field added. I'm running version 8.11.2-SNAPSHOT that I compiled myself. None of the other documents that were indexed prior to the addition contained that field.

The _root_ field is related to the nested document functionality, which I have never used. If the schema does not contain anything that can match _root_ then that field will not exist in the index.

You should not have a dynamic field named *. It can lead to unexpected behavior. This means that any field name in the indexed documents will be added to the index ... instead of throwing an error, which is what it should do if you send data that Solr is not expecting.

I did just another test where I added these two lines, and newly indexed documents did NOT have the _root_ field:

<field name="_root_" type="string" indexed="false" stored="false" docValues="false"/>
<dynamicField name="*" type="string" indexed="false" stored="true"/>

Thanks,
Shawn

Reply via email to