RediSearch / redisearch-py

RediSearch python client

Home Page:https://redisearch.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't create an index with a single field

clmnin opened this issue · comments

definition = redisearch.IndexDefinition(
    prefix=['user:'], index_type=redisearch.client.IndexType.JSON)

SCHEMA = (
    redisearch.TextField("$.phone", as_name="phone")
)
rc = redisearch.Client("idx:user")

try:
    rc.info()
except redis.ResponseError:
    # Index does not exist. We need to create it!
    rc.create_index(SCHEMA, definition=definition)

Give this error

TypeError: 'TextField' object is not iterable

@clmno
Try to use with comma

SCHEMA = (
    redisearch.TextField("$.phone", as_name="phone"),
)

Thank you