Skip to content

ResponseError: Invalid field type for field content_vector #273

@hack-r

Description

@hack-r

This is for the Chatbot app.

I have the Redisearch module loaded. The errant code:


# Optional step to drop the index if it already exists
#redis_client.ft(INDEX_NAME).dropindex()

# Check if index exists
try:
    redis_client.ft(INDEX_NAME).info()
    print("Index already exists")
except Exception as e:
    print(e)
    # Create RediSearch Index
    print('Not there yet. Creating')
    redis_client.ft(INDEX_NAME).create_index(
        fields = fields,
        definition = IndexDefinition(prefix=[PREFIX], index_type=IndexType.HASH)
    )

Output:

Unknown Index name
Not there yet. Creating

---------------------------------------------------------------------------
ResponseError                             Traceback (most recent call last)
Cell In[40], line 6
      5 try:
----> 6     redis_client.ft(INDEX_NAME).info()
      7     print("Index already exists")

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/commands/search/commands.py:370, in SearchCommands.info(self)
    363 """
    364 Get info an stats about the the current index, including the number of
    365 documents, memory consumption, etc
    366 
    367 For more information see `FT.INFO <https://redis.io/commands/ft.info>`_.
    368 """
--> 370 res = self.execute_command(INFO_CMD, self.index_name)
    371 it = map(to_string, res)

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1258, in Redis.execute_command(self, *args, **options)
   1257 try:
-> 1258     return conn.retry.call_with_retry(
   1259         lambda: self._send_command_parse_response(
   1260             conn, command_name, *args, **options
   1261         ),
   1262         lambda error: self._disconnect_raise(conn, error),
   1263     )
   1264 finally:

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/retry.py:46, in Retry.call_with_retry(self, do, fail)
     45 try:
---> 46     return do()
     47 except self._supported_errors as error:

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1259, in Redis.execute_command.<locals>.<lambda>()
   1257 try:
   1258     return conn.retry.call_with_retry(
-> 1259         lambda: self._send_command_parse_response(
   1260             conn, command_name, *args, **options
   1261         ),
   1262         lambda error: self._disconnect_raise(conn, error),
   1263     )
   1264 finally:

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1235, in Redis._send_command_parse_response(self, conn, command_name, *args, **options)
   1234 conn.send_command(*args)
-> 1235 return self.parse_response(conn, command_name, **options)

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1275, in Redis.parse_response(self, connection, command_name, **options)
   1274     else:
-> 1275         response = connection.read_response()
   1276 except ResponseError:

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/connection.py:957, in Connection.read_response(self, disable_decoding)
    956 if isinstance(response, ResponseError):
--> 957     raise response
    958 return response

ResponseError: Unknown Index name

During handling of the above exception, another exception occurred:

ResponseError                             Traceback (most recent call last)
Cell In[40], line 12
     10 # Create RediSearch Index
     11 print('Not there yet. Creating')
---> 12 redis_client.ft(INDEX_NAME).create_index(
     13     fields = fields,
     14     definition = IndexDefinition(prefix=[PREFIX], index_type=IndexType.HASH)
     15 )

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/commands/search/commands.py:141, in SearchCommands.create_index(self, fields, no_term_offsets, no_field_flags, stopwords, definition, max_text_fields, temporary, no_highlight, no_term_frequencies, skip_initial_scan)
    138 except TypeError:
    139     args += fields.redis_args()
--> 141 return self.execute_command(*args)

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1258, in Redis.execute_command(self, *args, **options)
   1255 conn = self.connection or pool.get_connection(command_name, **options)
   1257 try:
-> 1258     return conn.retry.call_with_retry(
   1259         lambda: self._send_command_parse_response(
   1260             conn, command_name, *args, **options
   1261         ),
   1262         lambda error: self._disconnect_raise(conn, error),
   1263     )
   1264 finally:
   1265     if not self.connection:

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/retry.py:46, in Retry.call_with_retry(self, do, fail)
     44 while True:
     45     try:
---> 46         return do()
     47     except self._supported_errors as error:
     48         failures += 1

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1259, in Redis.execute_command.<locals>.<lambda>()
   1255 conn = self.connection or pool.get_connection(command_name, **options)
   1257 try:
   1258     return conn.retry.call_with_retry(
-> 1259         lambda: self._send_command_parse_response(
   1260             conn, command_name, *args, **options
   1261         ),
   1262         lambda error: self._disconnect_raise(conn, error),
   1263     )
   1264 finally:
   1265     if not self.connection:

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1235, in Redis._send_command_parse_response(self, conn, command_name, *args, **options)
   1231 """
   1232 Send a command and parse the response
   1233 """
   1234 conn.send_command(*args)
-> 1235 return self.parse_response(conn, command_name, **options)

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1275, in Redis.parse_response(self, connection, command_name, **options)
   1273         options.pop(NEVER_DECODE)
   1274     else:
-> 1275         response = connection.read_response()
   1276 except ResponseError:
   1277     if EMPTY_RESPONSE in options:

File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/connection.py:957, in Connection.read_response(self, disable_decoding)
    954     self.next_health_check = time() + self.health_check_interval
    956 if isinstance(response, ResponseError):
--> 957     raise response
    958 return response

ResponseError: Invalid field type for field `content_vector`


Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions