Please see the code below.
Results when calling ElasticSearch.
"_source": {
"TEST1": 450304485,
"TEST2": 1612465007053,
"GEOMETRY": {
"TYPE": "MultiLineString",
"COORDINATES": [
[
[
-83.01273,
39.94391
],
[
-83.01273,
39.94374
],
[
-83.01272,
39.94357
],
[
-83.01261,
39.94339
],
[
-83.01238,
39.94302
],
[
-83.01209,
39.94253
]
]
]
},
"VERSION": "20.2"
}
// .Net class
public class TestData
{
public long Test1 { get; set; }
public long Test2 { get; set; }
[GeoShape(Name = "COORDINATES")]
public MultiLineStringGeoShape Geometry { get; set; }
}
var url = configuration["elasticsearch:url"];
var defaultIndex = configuration["elasticsearch:index"];
var pool = new SingleNodeConnectionPool(new Uri(url));
var settings = new ConnectionSettings(pool , sourceSerializer: JsonNetSerializer.Default).DefaultIndex(defaultIndex);
settings.DefaultMappingFor(m => m
.PropertyName(td => td.Type, "TYPE")
.PropertyName(td => td.Coordinates, "COORDINATES"));
settings.DefaultMappingFor<TestData>(m => m
.PropertyName(td => td.Test1, "TEST1")
.PropertyName(td => td.Test2, "TEST2")
.PropertyName(td => td.Geometry, "GEOMETRY"));
var client = new ElasticClient(settings);
Results back in .Net after the call
[
{
"test1": 450304485,
"test2": 1612465007053,
"geometry": null
}
]
I can't the get geometry data deserialized when the results come back successfully. Since this a NEST type should the default deserializer get the geometry data? Any suggestions would be greatly appreciated..