title: Solr DIH: Nested documents ignored by Child Transformer (not ignored using json endpoint)
body: <p><strong>Shortly</strong></p>
  <ul>
  <li><p>When I import data using <code>DIH</code>  stored into a relation database (using <code>child=true</code>), nested documents are NOT attached when <code>fl=*,[child]</code>.</p>
  </li>
  <li><p>When I import same data, structured as <code>json</code> documents (using <code>/update/json/docs</code> endpoint), nested documents are attached.</p>
  </li>
  </ul>
  <p>Short issues:</p>
  <ol>
  <li><code>&quot;_childDocuments_&quot;:[]</code> on debug <code>DIH</code> execution.</li>
  <li>Only <code>_root_</code> is populated. According to documentation <code>_nest_path_</code> should be populated automatically as well.</li>
  <li>Nested documents are not returned with parent when <code>fl=*,[child]</code></li>
  </ol>
  <p><strong>Detailed problem</strong></p>
  <p><strong>SQL Data</strong>:</p>
  <p><code>Parents</code>:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT '1' AS id,
     'parent-name-1' AS name_s,
     'parent' AS node_type_s
  </code></pre>
  <pre><code>+----+---------------+-------------+
  | id |    name_s     | node_type_s |
  +----+---------------+-------------+
  |  1 | parent-name-1 | parent      |
  +----+---------------+-------------+
  </code></pre>
  <p><code>Children</code>:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT '1-1' AS id,
         '1' AS parent_id_s,
         'child-name-1' AS name_s,
         'child' AS node_type_s
  UNION
  SELECT '2-1' AS id,
         '1' AS parent_id_s,
         'child-name-2' AS name_s,
         'child' AS node_type_s
  </code></pre>
  <pre><code>+-----+-------------+--------------+-------------+
  | id  | parent_id_s |    name_s    | node_type_s |
  +-----+-------------+--------------+-------------+
  | 1-1 |           1 | child-name-1 | child       |
  | 2-1 |           1 | child-name-2 | child       |
  +-----+-------------+--------------+-------------+
  </code></pre>
  <p><strong>Same data in json</strong>:</p>
  <pre class="lang-json prettyprint-override"><code>{
     &quot;id&quot;:&quot;1&quot;,
     &quot;name_s&quot;:&quot;parent-name-1&quot;,
     &quot;node_type_s&quot;:&quot;parent&quot;,
     &quot;children&quot;:[
        {
           &quot;id&quot;:&quot;1-1&quot;,
           &quot;parent_id_s&quot;:&quot;1&quot;,
           &quot;name_s&quot;:&quot;child-name-1&quot;,
           &quot;node_type_s&quot;:&quot;child&quot;
        },
        {
           &quot;id&quot;:&quot;2-1&quot;,
           &quot;parent_id_s&quot;:&quot;1&quot;,
           &quot;name_s&quot;:&quot;child-name-2&quot;,
           &quot;node_type_s&quot;:&quot;child&quot;
        }
     ]
  }
  </code></pre>
  <p><strong>Importing data with <code>DIH</code></strong>:</p>
  <p>Here my <code>DIH</code> configuration:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;dataConfig&gt;
      &lt;dataSource
          driver=&quot;com.microsoft.sqlserver.jdbc.SQLServerDriver&quot;
          url=&quot;jdbc:sqlserver://${dataimporter.request.host};databaseName=${dataimporter.request.database}&quot;
          user=&quot;${dataimporter.request.user}&quot;
          password=&quot;${dataimporter.request.password}&quot;
      /&gt;
  
      &lt;document&gt;
          &lt;entity
          name=&quot;parent&quot;
          query=&quot;SELECT '1' AS id,
                  'parent-name-1' AS name_s,
                  'parent' AS node_type_s&quot;&gt;
  
              &lt;field column=&quot;node_type_s&quot;/&gt;
              &lt;field column=&quot;id&quot;/&gt;
              &lt;field column=&quot;name_s&quot;/&gt;
  
              &lt;entity
              name=&quot;children&quot;
              child=&quot;true&quot;
              cacheKey=&quot;parent_id_s&quot; cacheLookup=&quot;parent.id&quot; cacheImpl=&quot;SortedMapBackedCache&quot;
              query=&quot;SELECT '1-1' AS id,
                      '1' AS parent_id_s,
                      'child-name-1' AS name_s,
                      'child' AS node_type_s
                  UNION
                  SELECT '2-1' AS id,
                      '1' AS parent_id_s,
                      'child-name-2' AS name_s,
                      'child' AS node_type_s&quot;&gt;
  
                  &lt;field column=&quot;node_type_s&quot;/&gt;
                  &lt;field column=&quot;id&quot;/&gt;
                  &lt;field column=&quot;parent_id_s&quot;/&gt;
                  &lt;field column=&quot;name_s&quot;/&gt;
  
              &lt;/entity&gt;
  
          &lt;/entity&gt;
  
      &lt;/document&gt;
  &lt;/dataConfig&gt;
  </code></pre>
  <p>After having imported <code>DIH</code>, here the response:</p>
  <pre class="lang-json prettyprint-override"><code>{
     &quot;responseHeader&quot;:{
        &quot;status&quot;:0,
        &quot;QTime&quot;:396
     },
     &quot;initArgs&quot;:[
        &quot;defaults&quot;,
        [
           &quot;config&quot;,
           &quot;parent-children-config-straightforward.xml&quot;
        ]
     ],
     &quot;command&quot;:&quot;full-import&quot;,
     &quot;mode&quot;:&quot;debug&quot;,
     &quot;documents&quot;:[
        {
           &quot;name_s&quot;:&quot;parent-name-1&quot;,
           &quot;node_type_s&quot;:&quot;parent&quot;,
           &quot;id&quot;:&quot;1&quot;,
           &quot;_version_&quot;:1683338565872779300,
           &quot;_root_&quot;:&quot;1&quot;,
           &quot;_childDocuments_&quot;:[
              
           ]
        }
     ],
     &quot;verbose-output&quot;:[
        
     ],
     &quot;status&quot;:&quot;idle&quot;,
     &quot;importResponse&quot;:&quot;&quot;,
     &quot;statusMessages&quot;:{
        &quot;Total Requests made to DataSource&quot;:&quot;2&quot;,
        &quot;Total Rows Fetched&quot;:&quot;3&quot;,
        &quot;Total Documents Processed&quot;:&quot;1&quot;,
        &quot;Total Documents Skipped&quot;:&quot;0&quot;,
        &quot;Full Dump Started&quot;:&quot;2020-11-14 12:25:55&quot;,
        &quot;&quot;:&quot;Indexing completed. Added/Updated: 1 documents. Deleted 0 documents.&quot;,
        &quot;Committed&quot;:&quot;2020-11-14 12:25:56&quot;,
        &quot;Time taken&quot;:&quot;0:0:0.365&quot;
     }
  }
  </code></pre>
  <p>Two issues here:</p>
  <ol>
  <li>As you can see <code>&quot;_childDocuments_&quot;:[]</code>. Why is it empty?</li>
  <li>Only <code>_root_</code> is populated. According to documentation <code>_nest_path_</code> should be populated as well.</li>
  </ol>
  <p><strong>Asking for documents</strong></p>
  <p>After having imported documents I've tried to retrive them, first using <code>q=*:*</code>:</p>
  <pre class="lang-json prettyprint-override"><code>{
     &quot;responseHeader&quot;:{
        &quot;status&quot;:0,
        &quot;QTime&quot;:0,
        &quot;params&quot;:{
           &quot;q&quot;:&quot;*:*&quot;,
           &quot;_&quot;:&quot;1605355606189&quot;
        }
     },
     &quot;response&quot;:{
        &quot;numFound&quot;:3,
        &quot;start&quot;:0,
        &quot;numFoundExact&quot;:true,
        &quot;docs&quot;:[
           {
              &quot;name_s&quot;:&quot;child-name-1&quot;,
              &quot;node_type_s&quot;:&quot;child&quot;,
              &quot;parent_id_s&quot;:&quot;1&quot;,
              &quot;id&quot;:&quot;1-1&quot;,
              &quot;_version_&quot;:1683338565872779264
           },
           {
              &quot;name_s&quot;:&quot;child-name-2&quot;,
              &quot;node_type_s&quot;:&quot;child&quot;,
              &quot;parent_id_s&quot;:&quot;1&quot;,
              &quot;id&quot;:&quot;2-1&quot;,
              &quot;_version_&quot;:1683338565872779264
           },
           {
              &quot;name_s&quot;:&quot;parent-name-1&quot;,
              &quot;node_type_s&quot;:&quot;parent&quot;,
              &quot;id&quot;:&quot;1&quot;,
              &quot;_version_&quot;:1683338565872779264
           }
        ]
     }
  }
  </code></pre>
  <p>All right, all documents are present.</p>
  <p><strong>Getting parent with its children</strong>:</p>
  <p><code>q=id:1</code> and <code>fl=*,[child]</code>:</p>
  <pre class="lang-json prettyprint-override"><code>{
     &quot;responseHeader&quot;:{
        &quot;status&quot;:0,
        &quot;QTime&quot;:0,
        &quot;params&quot;:{
           &quot;q&quot;:&quot;id:1&quot;,
           &quot;fl&quot;:&quot;*,[child]&quot;,
           &quot;_&quot;:&quot;1605355606189&quot;
        }
     },
     &quot;response&quot;:{
        &quot;numFound&quot;:1,
        &quot;start&quot;:0,
        &quot;numFoundExact&quot;:true,
        &quot;docs&quot;:[
           {
              &quot;name_s&quot;:&quot;parent-name-1&quot;,
              &quot;node_type_s&quot;:&quot;parent&quot;,
              &quot;id&quot;:&quot;1&quot;,
              &quot;_version_&quot;:1683338565872779264
           }
        ]
     }
  }
  </code></pre>
  <p>Other issue arises here:</p>
  <ol start="3">
  <li>Only parent is returned, wihout nested documents.</li>
  </ol>
  <p><strong>JSON approach</strong>:</p>
  <p>After having spent several days strugling with above issues, I tried to import same documents using <code>json</code> endpoint using above json data.</p>
  <p>After having imported them, I've performed the same above query:</p>
  <pre class="lang-json prettyprint-override"><code>{
     &quot;responseHeader&quot;:{
        &quot;status&quot;:0,
        &quot;QTime&quot;:2,
        &quot;params&quot;:{
           &quot;q&quot;:&quot;id:1&quot;,
           &quot;fl&quot;:&quot;*,[child]&quot;,
           &quot;_&quot;:&quot;1605355606189&quot;
        }
     },
     &quot;response&quot;:{
        &quot;numFound&quot;:1,
        &quot;start&quot;:0,
        &quot;numFoundExact&quot;:true,
        &quot;docs&quot;:[
           {
              &quot;id&quot;:&quot;1&quot;,
              &quot;name_s&quot;:&quot;parent-name-1&quot;,
              &quot;node_type_s&quot;:&quot;parent&quot;,
              &quot;_version_&quot;:1683339728909238272,
              &quot;children&quot;:[
                 {
                    &quot;id&quot;:&quot;1-1&quot;,
                    &quot;parent_id_s&quot;:&quot;1&quot;,
                    &quot;name_s&quot;:&quot;child-name-1&quot;,
                    &quot;node_type_s&quot;:&quot;child&quot;,
                    &quot;_version_&quot;:1683339728909238272
                 },
                 {
                    &quot;id&quot;:&quot;2-1&quot;,
                    &quot;parent_id_s&quot;:&quot;1&quot;,
                    &quot;name_s&quot;:&quot;child-name-2&quot;,
                    &quot;node_type_s&quot;:&quot;child&quot;,
                    &quot;_version_&quot;:1683339728909238272
                 }
              ]
           }
        ]
     }
  }
  </code></pre>
  <p>As you can see, nested documents are returned.</p>
  <p>Why?</p>
  <p>Please any ideas?</p>