Json Deserialize Exception coming while searching Elastic Search Indexes

Hi,
I am using 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.

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

Please help in resolving this issue.

Thanks,

1 Like

It sounds like you may be running Elasticsearch 7.x version and using NEST and 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 7.x to communicate with Elasticsearch 7.x. There is currently a 7.0.0-alpha2 prerelease available on Nuget and we're working to move towards a GA release shortly

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