# Json Deserialize Exception coming while searching Elastic Search Indexes

**URL:** <https://discuss.elastic.co/t/json-deserialize-exception-coming-while-searching-elastic-search-indexes/180655>\
**Category:** Elasticsearch\
**Created:** [May 11, 2019, 2:13pm UTC](https://discuss.elastic.co/t/json-deserialize-exception-coming-while-searching-elastic-search-indexes/180655 "2019-05-11T14:13:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![himanshum](https://avatars.discourse-cdn.com/v4/letter/h/a6a055/32.png) [@himanshum](https://discuss.elastic.co/u/himanshum)\
**Post date:** [May 11, 2019, 2:13pm UTC](https://discuss.elastic.co/t/json-deserialize-exception-coming-while-searching-elastic-search-indexes/180655/1 "2019-05-11T14:13:48Z")

</div>

Hi,  
I am using [Elasticsearch.Net](http://Elasticsearch.Net) and Nest Nuget Packages. version 6.7.0 for both.  
I have configured the server at localhost:9200/#/  
I have also created indexes.  
Now, while searching I am getting an exception.

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

Elasticsearch.Net.UnexpectedElasticsearchClientException: „Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Int64' because the type requires a JSON primitive value (e.g. string, number, boolean, null) to deserialize correctly. To fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'hits.total.value', line 1, position 115.”

I have followed this tutorial:  
[https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/nest-getting-started.html](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/nest-getting-started.html)

Please help in resolving this issue.

Thanks,

---

<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:** [May 17, 2019, 1:55pm UTC](https://discuss.elastic.co/t/json-deserialize-exception-coming-while-searching-elastic-search-indexes/180655/2 "2019-05-17T13:55:09Z")

</div>

It sounds like you may be running Elasticsearch 7.x version and using NEST and [Elasticsearch.Net](http://Elasticsearch.Net) 6.7.0 to communicate with it. The 6.x versions of these libraries are not compatible with Elasticsearch 7.x; you should use NEST and [Elasticsearch.Net](http://Elasticsearch.Net) 7.x to communicate with Elasticsearch 7.x. There is currently a [7.0.0-alpha2 prerelease available on Nuget](https://www.nuget.org/packages/NEST/7.0.0-alpha2) and we're working to move towards a GA release shortly

---

<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:** [June 14, 2019, 1:55pm UTC](https://discuss.elastic.co/t/json-deserialize-exception-coming-while-searching-elastic-search-indexes/180655/3 "2019-06-14T13:55:28Z")

</div>

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