-
Notifications
You must be signed in to change notification settings - Fork 332
JSON documents numeric field values are automatically rounding #1216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's the expected behavior. Note the JSON standard specifies:
For RedisJSON, numeric values are stored as a 64-bit floating point, a 64-bit signed integer, or a 64-bit unsigned integer. The exact behavior is explained here. You should upgrade RedisJSON to 2.6.10 or later (or Redis Stack to 7.2.0-v10 or later) to avoid a possible crash described in that issue. If you use integers larger than 2^64-1 and can't afford to lose precision, consider storing them as strings. |
@LiorKogan Hi, thanks for this explanation. However I think this functionality of storing af f64, i64 or u64 depending on needs might be not working correctly. I'm on RedisJSON 2.6.10 and I am seeing this behaviour: Here's the command, so you can copy-paste it in your instance or something:
Is there any way to make this work or do I really have to make it string and parse/unparse each time? I also assume int would take less space? |
@domints thank you, this seems to be an issue with Redis Insight's browser.
|
@LiorKogan that is indeed true! Thank you. Although this worries me, because I thought this was source of my problems. Maybe Redis.OM library also misinterprets it... |
@LiorKogan Would this be a problem with RediSearch or RedisJSON? :D
Essentially, I'm (what I mean by this is Redis.OM library) searching by this EDIT: |
I would assume RediSearch's numeric indexes do not use the same numeric types, I64/U64/F64, as in RedisJSON. @MeirShpilraien @oshadmi - can you please provide more details? |
I have a JSON document in the Redis stack, There's a field surId which holds a long-range numeric value, When I set the value, it automatically rounds to x000
That is if I set field surId as 8301034833169298414 it rounds to 8301034833169298000
If I set surId as 8301034833169297919 it rounds to 8301034833169297000
This can be tried from the Redis insight.
Is there any range limit for NumericField? Any workarounds that you can suggest?
RediSearch v. 2.8.9
RedisJSON v. 2.6.7
Redis Standalone Version: 7.2.3
The text was updated successfully, but these errors were encountered: