Nested Object Returning with default values

Hi guys,

Need help, using Elastic 5 when i do a search for a product on C#

var searchResponse = await Client.SearchAsync<Product>(s => s.Index(IndexName)
            .Query(q => q
                    .Term(p => p
                        .Field(f => f.Id)
                        .Value(productId))
                )
            ).ConfigureAwait(false);

It returns my product but my nested objects come with default values. Below my index:

.Mappings(x => x
                    .Map<Product>(m => m
                        .Properties(ps => ps
                            .Nested<Composition>(comp => comp
                                .Name(name => name.Compositions).AutoMap())
                            .Nested<Variant>(variant => variant
                                .Name(name => name.Variants).AutoMap())
                            .Nested<ProductProperty>(prop => prop
                                .Name(name => name.Properties).AutoMap())
                            .Nested<Store>(store => store
                                .Name(name => name.Stores).AutoMap())
                        ).AutoMap()
                     )
                     .Map<Property>(prop => prop
                        .Properties(p => p
                            .Nested<PropertyValue>(pr => pr
                                .Name(name => name.PropertyValues).AutoMap())
                         ).AutoMap())
                 )

But it knows that i have stores because the count is correct.

Tks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.