Shawn, should having a dynamic field called “*” trigger either a warning in the logs or maybe even be forbidden? Is there a use case for having “*”?
> On Jan 25, 2022, at 6:30 PM, Shawn Heisey <apa...@elyograg.org> wrote: > > 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 _______________________ Eric Pugh | Founder & CEO | OpenSource Connections, LLC | 434.466.1467 | http://www.opensourceconnections.com <http://www.opensourceconnections.com/> | My Free/Busy <http://tinyurl.com/eric-cal> Co-Author: Apache Solr Enterprise Search Server, 3rd Ed <https://www.packtpub.com/big-data-and-business-intelligence/apache-solr-enterprise-search-server-third-edition-raw> This e-mail and all contents, including attachments, is considered to be Company Confidential unless explicitly stated otherwise, regardless of whether attachments are marked as such.