0

Trying to have nested child documents inside managed schema in solr 6.5 as -

<fieldType name="_nest_path_" class="solr.NestPathField"/> 
<field name="_root_" type="string" indexed="true" stored="false" docValues="false" />      
<field name="_childDocuments_" type="_nest_path_">
<field name="id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="firstname" type="text_general"  indexed="true" stored="true"/>
<field name="lastname" type="text_general"  indexed="true" stored="true"/>

But seems _nest_path_ field is not supported in solr 6.5 and getting error Error loading class solr.NestPathField.

Any alternatives to store child documents without using nest_path or is there something wrong that I am doing here?

This schema works perfectly fine in Solr 8.4

MatsLindh
  • 49,529
  • 4
  • 53
  • 84

1 Answers1

1

Child documents can be handled without using the nested documents feature - the nested documents feature just makes it easier and more automatic.

Nested documents were introduced with Solr 8 - so trying to use the feature with Solr 6 won't work as you've discovered.

In earlier versions, as far as I know, you'll have to make those updates manually with relevant fields referenced, then apply the block join query parser and childdoctransformer explicitly with these values.

If you can, upgrade to Solr 8 (in the newest dotrelease) as the feature work's as you'd expect there, instead of adding the complexity of handling it yourself to work around the limitations in the earlier release.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • Thanks for the update. I have already figured out block join parser and child doc transformer for retrieving the results but what will i need to define in the managed schema for the nested structure ? Posting nested json doesnt work since there is no schema for nested fields. Can you share a sample of managed schema in the older version ? Upgrading is something that wont be preferred because of some dependecies. – Sahil Chawla Apr 10 '20 at 11:57
  • There [are examples in the reference guide for 6.6, both for XML and JSON](https://lucene.apache.org/solr/guide/6_6/uploading-data-with-index-handlers.html#UploadingDatawithIndexHandlers-NestedChildDocuments). In general, the child documents are included in a `_childDocuments_` element. You don't need anything specific in your managed schema for a nested structure - in effect there really isn't a structure, it's processed on the way out and in the queries to simulate a nested structure, more or less (and there is only one type of child documents included with each document). – MatsLindh Apr 10 '20 at 16:17