question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sort failing due to serialization error

See original GitHub issue

When I apply a sort, the response is throwing an error when trying to convert the hits back to concrete types.

After looking into the code, it appears that the _score is null when a sort is applied. However, it fails to convert and throws an error. If I set TrackScores to true, it works correctly (_score comes back as 0 in this case). This happens on line 125 in https://github.com/elastic/elasticsearch-net/blob/master/src/Nest/CommonAbstractions/SerializationBehavior/StatefulDeserialization/ConcreteTypeConverter.cs

Here is the exception: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException was unhandled by user code HResult=-2146233088 Message=Cannot implicitly convert type ‘Newtonsoft.Json.Linq.JValue’ to ‘double’. An explicit conversion exists (are you missing a cast?) Source=Anonymously Hosted DynamicMethods Assembly StackTrace: at CallSite.Target(Closure , CallSite , Object ) at Nest.ConcreteTypeConverter.GetConcreteTypeUsingSelector[T](JsonSerializer serializer, ConcreteTypeConverter1 realConcreteConverter, JObject jObject) in c:\code\elasticsearch-net\src\Nest\CommonAbstractions\SerializationBehavior\StatefulDeserialization\ConcreteTypeConverter.cs:line 125 at Nest.ConcreteTypeConverter.GetUsingConcreteTypeConverter[T](JsonReader reader, JsonSerializer serializer, ConcreteTypeConverter1 realConcreteConverter) in c:\code\elasticsearch-net\src\Nest\CommonAbstractions\SerializationBehavior\StatefulDeserialization\ConcreteTypeConverter.cs:line 83 at Nest.ConcreteTypeConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in c:\code\elasticsearch-net\src\Nest\CommonAbstractions\SerializationBehavior\StatefulDeserialization\ConcreteTypeConverter.cs:line 62 at Nest.DefaultHitJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in c:\code\elasticsearch-net\src\Nest\CommonAbstractions\SerializationBehavior\StatefulDeserialization\ConcreteTypeConverter.cs:line 24 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id) InnerException:

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
curtismbeardcommented, Mar 8, 2016

I will work on a simple example that reproduces the issue. I am using 2.0.2.

0reactions
gmarzcommented, Mar 18, 2016

Thank you all for reporting this. It’ll be fixed in the next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is causing the sort Function serializable in spark?
The culprit here is the implicit ord: Ordering[SortOrder] - since the sort method (called within an anonymous function that must be ...
Read more >
Spark Error Task Not Serializable | The Startup
Cause of Task Not Serializable exception in Spark. Discusses functional interfaces in Java/Scala, closures, ObjectOutputStream.writeObject, Java 7 vs Java ...
Read more >
SerializationException: There was an error deserializing ...
I have just started making an app (following someone) using a movie API from tmdb. There appears to be an issue with the...
Read more >
Dealing With Bad Records in Kafka | Jon Boulineau
In brief, the issue is that when a record is encountered that cannot be deserialized from Avro (a.k.a a poison pill) an exception...
Read more >
SQL error messages and exceptions
2200W, XQuery serialization error: Attempted to serialize one or more ... XBM05, Startup failed due to missing product version information for <value> ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found