# Elasticsearch NEST - Documents values are NULL

**URL:** <https://discuss.elastic.co/t/elasticsearch-nest-documents-values-are-null/230291>\
**Category:** Elasticsearch\
**Created:** [April 29, 2020, 3:02am UTC](https://discuss.elastic.co/t/elasticsearch-nest-documents-values-are-null/230291 "2020-04-29T03:02:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![iluvcode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iluvcode/32/24929_2.png) [@iluvcode](https://discuss.elastic.co/u/iluvcode)\
**Post date:** [April 29, 2020, 3:02am UTC](https://discuss.elastic.co/t/elasticsearch-nest-documents-values-are-null/230291/1 "2020-04-29T03:02:29Z")

</div>

I upgraded Elasticsearch from 6.8 to 7.6 and after the upgrade values returned in the documents are all NULL.  
I do see the values coming in Debug information and total count is also correct but not sure why documents are NULL.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/5/05e798e034aeda2b8ffe8eca18cbbb92ad9f20f4.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/e/5e4de7f0ce486b65a5960d560a1af6d37edb3226.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/5/35397da962e979e2018a3f03778a47f06a6be307.png)

I tried suggestions mentioned in [ElasticSearch NEST - all fields are NULL](https://discuss.elastic.co/t/elasticsearch-nest-all-fields-are-null/221754) and [https://stackoverflow.com/questions/58175271/elasticsearch-net-nest-all-result-hit-fields-are-null-but-results-are-there](https://stackoverflow.com/questions/58175271/elasticsearch-net-nest-all-result-hit-fields-are-null-but-results-are-there) and still no luck.

I also tried adding property name and making them Pascal case and still no luck.

document is elasticsearch:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/5/85f1d97b3abc86809b6e3078bbf8224af8e5c858.png)

Indexing code:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/c/5c2ada21e8b23185b6ac27ed232a8fb875a903f4.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/0/a0b42bece2bfbc4110c10462aa37f11f5b81d8b8.png)

any suggestions ? I don't want to rollback to previous version.

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [April 29, 2020, 3:49am UTC](https://discuss.elastic.co/t/elasticsearch-nest-documents-values-are-null/230291/2 "2020-04-29T03:49:01Z")

</div>

> [@iluvcode](#):
>
> I tried suggestions mentioned in [ElasticSearch NEST - all fields are NULL](https://discuss.elastic.co/t/elasticsearch-nest-all-fields-are-null/221754) and [c# - ElasticSearch.NET / NEST - All result.Hit fields are null (but results are there) - Stack Overflow](https://stackoverflow.com/questions/58175271/elasticsearch-net-nest-all-result-hit-fields-are-null-but-results-are-there) and still no luck.
> 
> I also tried adding property name and making them Pascal case and still no luck.

There looks to be a bug in handling properties with no setters; [I've opened an issue to address](https://github.com/elastic/elasticsearch-net/issues/4680).

In the meantime, if you add a setter for each property (don't need one for `FullName`) **and**

1. use `DefaultFieldNameInferrer(p => p)` _if_ the setter is public

or

1. use `PropertyNameAttribute` or `DataMemberAttribute` _if_ the setter is public _or_ non-public

then models will be hydrated.

---

<div class="post-metadata">

**Author:** ![iluvcode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iluvcode/32/24929_2.png) [@iluvcode](https://discuss.elastic.co/u/iluvcode)\
**Post date:** [April 29, 2020, 4:28pm UTC](https://discuss.elastic.co/t/elasticsearch-nest-documents-values-are-null/230291/3 "2020-04-29T16:28:48Z")

</div>

Thank you @forloop. adding setter to the property resolved the issue. (If I see you in next ES conference I will buy you a drink 😆 )

---

<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:** [May 27, 2020, 4:28pm UTC](https://discuss.elastic.co/t/elasticsearch-nest-documents-values-are-null/230291/4 "2020-05-27T16:28:52Z")

</div>

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