Redis Sets with scores

Is there a way to assign scores to each member of a Redis Set without convert the data structure to a sorted set?

1 Like

Natively, I don’t think this is possible. However, when we want to perform some set operations on sorted set and set e.g (ZINTERSTORE), the weight attribute can be used as the score for the set in order to perform this operation. This in itself does not mean that the underlying set now has score associated with its values.

1 Like

Nope. That’s not what Redis Sets do. That said, depending on what you are using the set for, there might be some clever ways to store that data in other keys.


I think only best option is migrate data to Redis Sorted Set - if its inside Redis.

other option might be using RediSearch with Member id and Score value - you can do search query ordered by score, but that wont be quite efficient than sorted set.