Now the strange thing is that the ElasticSearch.Net client tries to
deserialize this result as a "User" object. Normally this deserialization
method will return null and not create any visible side-effects, but in my
case I'm using the field "created" as a DateTime field, and the
deserialization throws a nasty error.
My question is: Why on earth does the client spend energy deserializing a
response to an Index command, and into the wrong type? This looks like a
bug.
Now the strange thing is that the ElasticSearch.Net client tries to
deserialize this result as a "User" object. Normally this deserialization
method will return null and not create any visible side-effects, but in my
case I'm using the field "created" as a DateTime field, and the
deserialization throws a nasty error.
My question is: Why on earth does the client spend energy deserializing a
response to an Index command, and into the wrong type? This looks like a
bug.
This is because when using Elasticsearch.NET, specifying the type like that is actually specifying what type the expected response should be serialized into, rather than the type of object you're sending to Elasticsearch.
Drop the type completely and client.Index should return a ElasticsearchResponse object type.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.