title: Indexing nested data with Solr
body: <p>I am trying to index nested data with solr from an existing sql database. The DB has this structure 
  <a href="https://dev.mysql.com/doc/employee/en/images/employees-schema.png" rel="nofollow noreferrer">https://dev.mysql.com/doc/employee/en/images/employees-schema.png</a></p>
  
  <p>My db-schema.xml is the following:</p>
  
  <pre><code>&lt;document&gt;
      &lt;entity name="employees"
              rootEntity="true"
              query="select emp_no as 'id', first_name, last_name from employees limit 10;"&gt;
          &lt;field column="id" /&gt;
          &lt;field column="first_name" /&gt;
          &lt;field column="last_name" /&gt;
          &lt;entity child="true"
                  name="dept_emp"
                  query="select emp_no, dept_no from dept_emp where dept_emp.emp_no=${employees.id}"&gt;
              &lt;field column="dept_no" name='dept_no'/&gt;
          &lt;/entity&gt;
      &lt;/entity&gt;
    &lt;/document&gt;
  </code></pre>
  
  <p>and my managed-schema.xml for the solr is this:</p>
  
  <pre><code>    &lt;field name="first_name" type="string" indexed="true" stored="true" required="true" multiValued="false" /&gt;
      &lt;field name="last_name" type="string" indexed="true" stored="true" required="true" multiValued="false" /&gt;
      &lt;field name="dept_no" type="string" indexed="true" stored="true" required="true" multiValued="false" /&gt;
      &lt;field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /&gt;
  </code></pre>
  
  <p>The problem is that I get this error:</p>
  
  <pre><code>org.apache.solr.common.SolrException: [doc=null] missing required field: dept_no
  </code></pre>
  
  <p>Even if I remove </p>
  
  <pre><code>&lt;field name="dept_no" type="string" indexed="true" stored="true" required="true" multiValued="false" /&gt;
  </code></pre>
  
  <p>I get the error the last_name is missing. If I remove the nested entity everything works fine.
  Any idea why this is happening ?</p>