elasticsearch-net icon indicating copy to clipboard operation
elasticsearch-net copied to clipboard

Range types do not serialize with the correct property names

Open jeffpapp opened this issue 4 months ago • 1 comments

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

jeffpapp avatar Feb 21 '24 17:02 jeffpapp

Good catch! Thanks for reporting. This is probably a lookover from the time when this was ported over from NEST.

flobernd avatar Mar 04 '24 12:03 flobernd