Redis OM (Python) issues

I am giving Redis OM a try, but I am encountering unexpected behaviour. Running redismod on docker, here’s the code:

import datetime
from typing import Optional, List
from pydantic import EmailStr
from redis_om import HashModel, JsonModel, Field,  Migrator

class Stock(JsonModel):
    symbol: str = Field(index=True, sortable=False, full_text_search=False)
    stock_type: str = Field(index=True, sortable=False, full_text_search=False, default="")
    call_date: datetime.date = None
    test: List[float] = []
    age: int = None
    bio: str = None

    class Meta:
        global_key_prefix = "us"

Migrator().run()

wfc_z = Stock(symbol='WFCpZ', stock_type='ps', age=13)
wfc_z.save()

Stock.get(wfc_z.pk)
> "Stock(pk='01FPFFATZ1PCEXVC7A2AQ132A0', symbol='WFCpZ', stock_type='ps', call_date=None, test=[], age=13, bio=None)"

Stock.find(Stock.symbol == 'WFCpZ').all()
> "---------------------------------------------------------------------------
ResponseError                             Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_1143032/1089810842.py in <module>
----> 1 Stock.find(Stock.symbol == 'WFCpZ').all()

e:\projects\numba_test_py\.venv\lib\site-packages\redis_om\model\model.py in all(self, batch_size)
    759             query = self.copy(page_size=batch_size, limit=batch_size)
    760             return query.execute()
--> 761         return self.execute()
    762 
    763     def sort_by(self, *fields: str):

e:\projects\numba_test_py\.venv\lib\site-packages\redis_om\model\model.py in execute(self, exhaust_results)
    723         # If the offset is greater than 0, we're paginating through a result set,
    724         # so append the new results to results already in the cache.
--> 725         raw_result = self.model.db().execute_command(*args)
    726         count = raw_result[0]
    727         results = self.model.from_redis(raw_result)

e:\projects\numba_test_py\.venv\lib\site-packages\redis\client.py in execute_command(self, *args, **options)
    899         try:
    900             conn.send_command(*args)
--> 901             return self.parse_response(conn, command_name, **options)
    902         except (ConnectionError, TimeoutError) as e:
    903             conn.disconnect()

e:\projects\numba_test_py\.venv\lib\site-packages\redis\client.py in parse_response(self, connection, command_name, **options)
    913         "Parses a response from the Redis server"
    914         try:
--> 915             response = connection.read_response()
    916         except ResponseError:
    917             if EMPTY_RESPONSE in options:

e:\projects\numba_test_py\.venv\lib\site-packages\redis\connection.py in read_response(self)
    754 
    755         if isinstance(response, ResponseError):
--> 756             raise response
    757         return response
    758 

ResponseError: us:__main__.Stock:index: no such index"

I’ve tried running the Migrator at different points, but got the same result.

Can you make sure you’re running with the latest version of RedisJSON / RediSearch?

Answered here: https://discord.com/channels/697882427875393627/914885954878181426/918466550422454302

The issue was outdated redismod docker image.