You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently facing a tricky problem.
Some of my models have a GeoPoint, which represents coordinates (lat & lon) in two different float fields. For ElasticSearch to process these fields as I need it to, they need to have a float value, in any given circumstances.
The problem is, I default those coordinates to 0 (easy value to test throughout the codebase), and even when I force the (float) cast, and the type annotation is float too, the serializer ignores the decimal part if there is none (42.0 will result in 42), which is considered as an integer, and ElasticSearch doesn't seem to appreciate this kind of things...
The text was updated successfully, but these errors were encountered:
The interesting question is: "How is your elasticsearch set up?". I've tried to replicate this behaviour, yet my elasticsearch is able to store the number 42 into a floating number field without any problems.
Sorry I solved the problem without updating this issue...
As is turns out, my index mapping was not complete, so when I tried to index my documents, some of them had "round" floats in the buggy field, and some others had floats with decimals. So, when the first document indexed by ES had a "round" float, it was rendered as an int by the serializer, which caused ES to map this field as an integer (causing bugs when actual floats where to be indexed).
I solved it by updating the mapping to explicitly set it as a float is ES, and it now works like a charm!
Hi,
I'm currently facing a tricky problem.
Some of my models have a GeoPoint, which represents coordinates (lat & lon) in two different float fields. For ElasticSearch to process these fields as I need it to, they need to have a float value, in any given circumstances.
The problem is, I default those coordinates to 0 (easy value to test throughout the codebase), and even when I force the (float) cast, and the type annotation is float too, the serializer ignores the decimal part if there is none (42.0 will result in 42), which is considered as an integer, and ElasticSearch doesn't seem to appreciate this kind of things...
The text was updated successfully, but these errors were encountered: