Unfortunately, Solr is not as capable of defining nested documents as elasticsearch.
In Solr's case, the answer is to use multiValued
fields that mimic the desired information in the flattened document. Personally, I find this to be very limiting, particularly because grouped details (objects) may be separated, but it is the Solr way. You can use dynamic fields to fix this (e.g., school_name_1
is linked with school_degree_1
and school_name_2
with school_degree_2
), as suggested by arun's referenced link, but that's a much bigger hassle compared to the flexibility of elasticsearch.
If your document is in XML, then you can use the XPathEntityProcessor
to automatically flatten it. Perhaps more unfortunately, I am not aware of any JSON processor that performs the analogous action.
You're going to want a schema similar to:
<field name="first_name" indexed="true" />
<field name="last_name" indexed="true" />
<field name="school_name" multiValued="true" indexed="true" />
<field name="school_degree" multiValued="true" indexed="true" />
<field name="school_start_date" multiValued="true" indexed="true" />
Don't forget about the end date. You may also want to consider that students can have multiple degrees, though this could be solved by simply doubling up on the school, or making the degree an array when it's the same starting year.