I have integrated a series of ElasticSearch Nest code into our own solution file. Before I did this, I have it tested first in a separate solution. In my separate solution everything works fine.
The details of the exception is:
Elasticsearch.Net.UnexpectedElasticsearchClientException: The type initializer for 'Nest.JsonNetSerializer.Converters.HandleNestTypesOnSourceJsonConverter' threw an exception.
Upon checking the debug messages, here are some more details I got.
System.TypeLoadException: Could not load type 'Nest.CartesianPoint' from assembly 'Nest, Version=7.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxx'.
at Nest.JsonNetSerializer.Converters.HandleNestTypesOnSourceJsonConverter..cctor()
I've been googling around and I could not find a specific answer to this. All I can find is somehow my problem is kind of related to this since in my separate test code I do not have any of this exception - Could not load type from assembly error
To give some details, this is how I create my client.
private ElasticClient GetClient()
{
var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var connectionSettings = new ConnectionSettings(pool, (builtin, settings) =>
new JsonNetSerializer(builtin, settings, () =>
new JsonSerializerSettings {
TypeNameHandling = TypeNameHandling.All,
NullValueHandling = NullValueHandling.Include
}
)).DefaultIndex(DefaultIndex);
return new ElasticClient(connectionSettings);
}
Right now I'm looking into our solution files with this solution - Could not load type from assembly error - in mind to resolve this.
I'm hoping that someone might have encountered this before.
Thanks in advance.