# Nested Object Returning with default values

**URL:** <https://discuss.elastic.co/t/nested-object-returning-with-default-values/99739>\
**Category:** Elasticsearch\
**Created:** [September 7, 2017, 3:13pm UTC](https://discuss.elastic.co/t/nested-object-returning-with-default-values/99739 "2017-09-07T15:13:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jorge\_Cruz](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@Jorge\_Cruz](https://discuss.elastic.co/u/Jorge_Cruz)\
**Post date:** [September 7, 2017, 3:14pm UTC](https://discuss.elastic.co/t/nested-object-returning-with-default-values/99739/1 "2017-09-07T15:14:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 5, 2017, 3:14pm UTC](https://discuss.elastic.co/t/nested-object-returning-with-default-values/99739/2 "2017-10-05T15:14:05Z")

</div>

Closed on October 5, 2017, 3:14pm UTC

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