FT.SEARCH, RETURN with field alias not working?

Hi, according to documentation: FT.SEARCH | Redis
this command should work:
FT.SEARCH ch:advertisements * RETURN 1 id AS foo
but it ends with:
Unknown argument AS at position 4 for <main>

Why?

I use RedisStack (docker) 6.2.13.

I think RETURN 1 id AS foo should be RETURN 3 id AS foo.

Why? I return only one field.

It’s a bit confusing. The number represents the number of tokens rather than the number of fields. It’s for the RediSearch command parser, letting RediSearch know when to stop parsing the tokens as fields and start parsing the next option.

2 Likes

Yes, it’s confusing. Thanks @sazzadul @jgaskins