If you only intend to look up your data by key, then key lookup is the most effective way to go (e.g. you store a user sesssion in Redis, use the userid as a key and only ever look up the session data by user)
On the other hand, if you want to search based on the content of the data, iterating over all the keys and looking at all the data would be extremely inefficient, whilst an index would very efficiently obtain all keys whose data content matches your search (e.g. if in the user session example you want to find all users who have a particular product stored within the session in their shopping cart to target a promotional offer)
In addition, other search use cases such as geographical searches or vector searches would simply be impossible with key alone.