Skip to content

Geo-Shape - invalid serialization when used JsonNetSerializer.Default #3096

@stefando

Description

@stefando

NEST/Elasticsearch.Net version: 6.0.1

Elasticsearch version: 6.2.1

Description of the problem including expected versus actual behavior:

We are indexing the data containing geo-shape data.
When using JsonNetSerializer these data are serialized incorrectly.
(Default serializer works OK.)

var point = new PointGeoShape(new GeoCoordinate(lat, lon));

With default serializer (expected):

{
    "geometry": {
        "type": "geometrycollection",
        "geometries": [
            {
                "coordinates": [
                    49.105995,
                    21.9926492
                ],
                "type": "point"
            },
            {
                "coordinates": [
                    49.1017987,
                    21.9909713
                ],
                "type": "point"
            }
        ]
    }
}

With JsonNetSerializer (actual):

{
    "geometry": {
        "type": "geometrycollection",
        "geometries": [
            {
                "coordinates": {
                    "lat": 49.105995,
                    "lon": 21.9926492
                },
                "type": "point"
            },
            {
                "coordinates": {
                    "lat": 49.1017987,
                    "lon": 21.9909713
                },
                "type": "point"
            }
        ]
    }
}

which produces the following error:

json_parse_exception Reason: "Current token (FIELD_NAME) not numeric, can not use numeric value accessors
 at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@248dbc2c; line: 1, column: 462]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions