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
The following covers what the bug is, instructions to reproduce it and why i think it happens.
We use opensearch where I work
One day, I got this error:
- I am confident this is because of how the library deals with types internally to speak to opensearch API. the following is why:
- This error comes specifically when workflow.actions.position.X has a value of **float64(206)**. Usually, since these positions are entered by the user through the GUI, the probability of these positional values being perfect is less. Usually, they have a decimal at the end. But when i got this bug, It just so happened that there was a perfect value at use.
Here is how the struct for this object looks like:
Here is what i think is happening demonstrated with an example (this is pretty interesting):
this is for a golang code that uses a float value, puts it into a struct (which expects float64), converts it into JSON.
Notice how even for values which are typed as float64, the JSON object converted might convert them into what might be confused as an integer, rather than a float.
This might cause the API server to throw the errors it is throwing :)
Update:
this fixes the issue temporarily but i can see similar annoying bugs with timestamps as well. Thought you all should know.
The text was updated successfully, but these errors were encountered:
0x0elliot
changed the title
mapper [x] cannot be changed from type [float64] to [long] #357
mapper [x] cannot be changed from type [float] to [long] #357
Oct 7, 2023
0x0elliot
changed the title
mapper [x] cannot be changed from type [float] to [long] #357
mapper [x] cannot be changed from type [float] to [long]
Oct 7, 2023
For context, we do use json.Marshal() ourselves to convert these values to JSON. so, technically, it's us who is causing this bug, but I wonder if you folks can also watch out for something like this somehow.
Thanks for the report @0x0elliot. What do you expect the library to do in this case? Maybe try to write a unite test that reproduces the error?
Thanks for the response @dblock. I decided that it's rather a encoding/json issue and has nothing to do with go-opensearch. But this existing in the first place would be important for anyone else coming across such bugs.
The following covers what the bug is, instructions to reproduce it and why i think it happens.
Here is what i think is happening demonstrated with an example (this is pretty interesting):
Update:
this fixes the issue temporarily but i can see similar annoying bugs with timestamps as well. Thought you all should know.
The text was updated successfully, but these errors were encountered: