elasticsearch-net
elasticsearch-net copied to clipboard
Range types do not serialize with the correct property names
Elastic.Clients.Elasticsearch version: 8.12.0
Elasticsearch version: 8.12.1
.NET runtime version: .NET 8
Operating system version: Windows 11
Description of the problem including expected versus actual behavior:
The Range types are using [DataMember]
attributes to define the JSON property names but these aren't used by System.Net.Json. The JsonPropertyName
attribute should be used instead. This causes an error when trying to index a document because the JSON looks like { "greaterThanOrEqualTo": 1, "lessThanOrEqualTo": 2 }
instead of { "gte": 1, "lte": 2 }
Expected behavior Using a range type should properly serialize with the correct JSON property names
Good catch! Thanks for reporting. This is probably a lookover from the time when this was ported over from NEST.