# Nest 7.17 or Elastic.Clients.Elasticsearch 8.1.0 with Server 8.7.1returns a valid JSON but fails to set SearchResponse\<T\>.Documents

**URL:** <https://discuss.elastic.co/t/nest-7-17-or-elastic-clients-elasticsearch-8-1-0-with-server-8-7-1returns-a-valid-json-but-fails-to-set-searchresponse-t-documents/336141>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [June 15, 2023, 9:01pm UTC](https://discuss.elastic.co/t/nest-7-17-or-elastic-clients-elasticsearch-8-1-0-with-server-8-7-1returns-a-valid-json-but-fails-to-set-searchresponse-t-documents/336141 "2023-06-15T21:01:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Viktor\_Markhelyuk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/viktor_markhelyuk/32/122312_2.png) [@Viktor\_Markhelyuk](https://discuss.elastic.co/u/Viktor_Markhelyuk)\
**Post date:** [June 15, 2023, 9:01pm UTC](https://discuss.elastic.co/t/nest-7-17-or-elastic-clients-elasticsearch-8-1-0-with-server-8-7-1returns-a-valid-json-but-fails-to-set-searchresponse-t-documents/336141/1 "2023-06-15T21:01:31Z")

</div>

Nest 5.0.0 with Server 5.6.1 runs correctly:  
result.DebugInformation shows a valid response JSON  
and a C# POCO: WX\_ORDER fills in with the response hits.hits.\_source data  
With Nest 7.17 or Elastic.Clients.Elasticsearch 8.1.0 requesting an Elastic 8.7.1 server  
however unexpectedly: 1) same query returns same hits.hits.\_source  
2) but it fails to deserialize it into an application POCO object.

```auto
ar sr = new SearchRequest<T>();
sr.Query = tq;
var startIdx = (_pageNo - 1) * _pageSize; // Page Number is 1-based
sr.From = startIdx;
sr.Size = _pageSize;
sr.Sort = _sortBy;
var result = _client.Search<T>(sr);
_log.Debug(result.DebugInformation);
_s.Total = result.Total;
_s.Page = _pageNo;
_s.Results = result.Documents;

```

result.Documents contains a valid count(1) but each element is an instance of WX\_DOCUMENT created by a default constructor.

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

---

<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:** [July 13, 2023, 9:02pm UTC](https://discuss.elastic.co/t/nest-7-17-or-elastic-clients-elasticsearch-8-1-0-with-server-8-7-1returns-a-valid-json-but-fails-to-set-searchresponse-t-documents/336141/2 "2023-07-13T21:02:14Z")

</div>

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