title: Nested Documents with spring-data solr
body: <p>I'm very new to spring-data SOLR and SOLR, so please forgive me some stupid rookie questions.</p>
  
  <p>Currently I'm creating a spring-boot 1.4.1.RELEASE application, spring-data solr 2.0.3.RELEASE and solr-solrj 5.5.3 together with Java 8.</p>
  
  <p>I'm able to put data into a local SOLR instance, but the data in SOLR do not look like I've expected - maybe I'm expecting wrong?</p>
  
  <p>My data looks like this:</p>
  
  <pre><code>public class Retailer{
      /**
       * The number of the retailer, unique identifier
       */
      @Id
      @Indexed
      @Field
      @NotBlank(message = ValidationConstants.ERROR_MISSING_SAP_RETAILER_NUMBER)
      @Column(unique = true)
      private String sapRetailerNumber; // NOSONAR
  
      /**
       * The company name of the retailer.
       */
      @Field
      @Indexed
      @NotBlank(message = ValidationConstants.ERROR_VALIDATION_MISSING_NAME)
      private String name; // NOSONAR
  
      @Field(child=true, value="retailerContact")
      @Indexed
      @NotNull(message = ValidationConstants.ERROR_VALIDATION_MISSING_CONTACTINFO)
      @Valid
      private Contact contact;
  
      @Field(child=true, value="retailerAddress")
      @Indexed
      @NotNull(message = ValidationConstants.ERROR_VALIDATION_MISSING_ADDRESS)
      @Valid
      private Address address;
  }
  </code></pre>
  
  <p>class Contact:</p>
  
  <pre><code>public class Contact {
      @Field
      @Indexed
      @NotBlank(message = ValidationConstants.ERROR_VALIDATION_MISSING_EMAIL)
      @Email(message = ValidationConstants.ERROR_VALIDATION_INVALID_EMAIL, regexp = ValidationConstants.EXPRESSION_RFC5322_MAIL)
      private String email; // NOSONAR
  
      @Field
      @Indexed
      @NotBlank(message = ValidationConstants.ERROR_VALIDATION_MISSING_HOMEPAGE)
      private String homepage; // NOSONAR
  
      @Field
      @Indexed
      private String phone; // NOSONAR
  
      @Field
      @Indexed
      private String fax; // NOSONAR
  }
  </code></pre>
  
  <p>The class Address is similar to Contact. What I expected is to have structured data in SOLR, but the objects Contact and Address are flattened. As far I found there is a feature called Nested Documents which supports structured data and I hoped to activate this feature by giving the annotation</p>
  
  <pre><code>@Field(child=true, value="retailerContact")
  </code></pre>
  
  <p>but unfortunately this didn't change anything.</p>
  
  <p>Is there somewhere an spring-data SOLR example using Nested Documents? The example linked in the spring-data SOLR homepage does not seem to use this feature.</p>
  
  <p>Any hint is appreciated, thank you in advance!</p>