Issue in deserializing WKT Geoshape

Hi,

I've got an unexpected exception when I'm querying an index containing GeoShape data.
My index is a city with a geo_shape property which represents the polygon of the city.

After indexing all my cities, I'm querying this index and I got an exception for some documents.

For instance: Elasticsearch.Net.UnexpectedElasticsearchClientException: Expected number but found: E at line 1, position 2719 ---> Nest.GeoWKTException: Expected number but found: E at line 1, position 2719

I found out why. My polygon has a weird geo point : -2.5E-05

Here the stacktrace:

Elasticsearch.Net.UnexpectedElasticsearchClientException: Expected number but found: E at line 1, position 2719 ---> Nest.GeoWKTException: Expected number but found: E at line 1, position 2719
   at Nest.GeoWKTReader.NextNumber(WellKnownTextTokenizer tokenizer)
   at Nest.GeoWKTReader.ParseCoordinate(WellKnownTextTokenizer tokenizer)
   at Nest.GeoWKTReader.ParseCoordinates(WellKnownTextTokenizer tokenizer)
   at Nest.GeoWKTReader.ParseCoordinateLists(WellKnownTextTokenizer tokenizer)
   at Nest.GeoWKTReader.ParsePolygon(WellKnownTextTokenizer tokenizer)
   at Nest.GeoWKTReader.Read(WellKnownTextTokenizer tokenizer, String shapeType)
   at Nest.GeoWKTReader.Read(String wellKnownText)
   at Nest.GeoShapeFormatter.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)
   at Deserialize(Object[] , JsonReader& , IJsonFormatterResolver )
   at Elasticsearch.Net.Utf8Json.Resolvers.DynamicMethodAnonymousFormatter`1.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)
   at Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Byte[] bytes, Int32 offset, IJsonFormatterResolver resolver)
   at Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Byte[] bytes, IJsonFormatterResolver resolver)
   at Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Stream stream, IJsonFormatterResolver resolver)
   at Nest.DefaultHighLevelSerializer.Deserialize[T](Stream stream)
   at Elasticsearch.Net.DiagnosticsSerializerProxy.Deserialize[T](Stream stream)
   at Nest.SourceFormatter`1.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)
   at Deserialize(Object[] , JsonReader& , IJsonFormatterResolver )
   at Elasticsearch.Net.Utf8Json.Resolvers.DynamicMethodAnonymousFormatter`1.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)
   at Nest.ReadAsFormatter`2.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)
   at Elasticsearch.Net.Utf8Json.Formatters.CollectionFormatterBase`4.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)
   at Deserialize(Object[] , JsonReader& , IJsonFormatterResolver )
   at Elasticsearch.Net.Utf8Json.Resolvers.DynamicMethodAnonymousFormatter`1.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)
   at Nest.ReadAsFormatter`2.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)
   at Deserialize(Object[] , JsonReader& , IJsonFormatterResolver )
   at Elasticsearch.Net.Utf8Json.Resolvers.DynamicMethodAnonymousFormatter`1.Deserialize(JsonReader& reader, IJsonFormatterResolver formatterResolver)
   at Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Byte[] bytes, Int32 offset, IJsonFormatterResolver resolver)
   at Elasticsearch.Net.Utf8Json.JsonSerializer.Deserialize[T](Byte[] bytes, IJsonFormatterResolver resolver)
   at Elasticsearch.Net.Utf8Json.JsonSerializer.DeserializeAsync[T](Stream stream, IJsonFormatterResolver resolver)...

The original WKT was:

POLYGON ((-0.006398 44.588017,-0.006934 44.588301,-0.009124 44.588594,-0.008983 44.588967,-0.011063 44.589696,-0.011266 44.58942,-0.012267 44.589783,-0.012459 44.589554,-0.013572 44.590541,-0.017456 44.591103,-0.019132 44.590944,-0.019321 44.592081,-0.019716 44.593293,-0.019099 44.594691,-0.018417 44.595431,-0.016307 44.596816,-0.017332 44.597405,-0.017781 44.597089,-0.018548 44.597507,-0.018052 44.598736,-0.016321 44.600649,-0.016231 44.601559,-0.016067 44.601815,-0.015525 44.602142,-0.014585 44.602343,-0.013453 44.602819,-0.013068 44.603701,-0.008716 44.605084,-0.00845 44.605199,-0.008521 44.605333,-0.00758 44.60551,-0.006295 44.606043,-0.007994 44.607296,-0.008806 44.607314,-0.009764 44.607009,-0.011068 44.608229,-0.011522 44.608388,-0.011883 44.608725,-0.013054 44.608345,-0.013665 44.608385,-0.013885 44.608812,-0.014826 44.609172,-0.014626 44.609488,-0.015129 44.610497,-0.014218 44.613103,-0.013072 44.61444,-0.011742 44.616385,-0.010904 44.617087,-0.010421 44.617284,-0.009663 44.618165,-0.009092 44.619407,-0.009134 44.620367,-0.008633 44.621804,-0.00504 44.621003,-0.004606 44.619437,-0.004149 44.619677,-0.003016 44.619967,-0.001793 44.620504,-0.001952 44.62199,-0.001856 44.62289,-0.001519 44.623352,-0.001364 44.623391,-0.001163 44.623976,0.000201 44.624808,0.000607 44.625354,0.002171 44.624872,0.003715 44.623831,0.004433 44.623673,0.005454 44.622984,0.006917 44.622461,0.007293 44.622037,0.009918 44.620499,0.013277 44.619909,0.015858 44.617343,0.015914 44.617203,0.015461 44.616504,0.015662 44.616048,0.016044 44.615667,0.017331 44.614911,0.017972 44.615224,0.022267 44.612973,0.023139 44.611824,0.023893 44.611236,0.025445 44.609381,0.032372 44.603392,0.03227 44.602486,0.0317 44.601796,0.030703 44.601341,0.027205 44.598117,0.026396 44.597586,0.025164 44.597176,0.024376 44.596406,0.024885 44.59479,0.025134 44.592374,0.026765 44.592004,0.026934 44.591885,0.026894 44.591551,0.026263 44.590748,0.025839 44.589659,0.025124 44.588694,0.024298 44.58848,0.022791 44.588433,0.021333 44.587822,0.020833 44.587398,0.019522 44.587224,0.01806 44.587571,0.017402 44.587548,0.015641 44.58671,0.014358 44.586278,0.013375 44.58581,0.011964 44.58689,0.011561 44.586694,0.010076 44.587716,0.009663 44.587319,0.008677 44.587859,0.008711 44.588023,0.008198 44.588137,0.007573 44.588664,0.006392 44.589229,0.005935 44.587927,0.006002 44.586881,0.006155 44.586794,0.005466 44.586113,0.005344 44.585744,0.004945 44.585325,0.005112 44.585091,0.00419 44.585448,0.003732 44.585922,0.003311 44.58607,0.003219 44.586252,0.001708 44.586787,0.001759 44.587122,0.00024 44.587541,-0.000025 44.587736,-0.000602 44.588702,-0.001406 44.588558,-0.001853 44.589188,-0.003142 44.588988,-0.004143 44.58849,-0.006398 44.588017))

I guess this is due to the -0.000025 data point format.

I'm using the ElasticSearch v7.2 on Windows 10.
My app is built in .netCore 2.2 using NEST 7.0.0.
The polygone mapping is:
"polygone":{
"type": "geo_shape"
}

What do you think ElasticSearch guys :slight_smile:

Thanks in advance,

Patrice

I think this is an issue specific to the NEST client, could open a GitHub issue so the relevant people can have a look into it:

OK, thanks.
I've just created a new one (Issue in deserializing WKT Geoshape · Issue #3920 · elastic/elasticsearch-net · GitHub)

1 Like

Thanks for filing an issue, @PatriceMarin :+1:

Your determination is correct. I'll fix this in the next release and keep you informed on the GitHub issue.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.