node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

FT.AGGREGATE _ LOAD * is not supported

Open ivan-kleshnin opened this issue 1 year ago • 3 comments

Description

I'm not sure if it counts as a bug or a half-implemented feature...

https://redis.io/commands/ft.aggregate/ If * is used as nargs, all attributes in a document are loaded.

I assume it is not supported – couldn't find any mention in issues or elsewhere.

Example: FT.AGGREGATE idx:user * LOAD * should return all fields of all indexed "user" documents.

await client.aggregate(`idx:user`, "*", {
  LOAD: "*", // causes TS error, does not work as JS as well
  // TS2345: Argument of type [string, string, {LOAD: "*";}] is not assignable to parameter of type
})

It seems Node-Redis supports only basic named fields like LOAD: "@email". It does not support load all functionality which is IMO necessary, for example, to implement cursor-based pagination.

await client.aggregate(`idx:user`, "*", {
  LOAD: "@email", 
}) // works fine

Node.js Version

21.7.1

Redis Server Version

7.2.4

Node Redis Version

7.2.4

Platform

macOS

Logs

No response


Update

As a temporary low-level solution it's possible to:

await client.sendCommand(["FT.AGGREGATE", "idx:user", "*", "LOAD", "*"])

Requires manual reply, manual JSON parsing, etc.

ivan-kleshnin avatar Mar 29 '24 13:03 ivan-kleshnin

Very annoying lol +1

7f8ddd avatar Sep 11 '24 18:09 7f8ddd

Thanks for the workaround, thought I was lowkey doomed

dualdetail avatar Feb 10 '25 01:02 dualdetail

Upvote. Very annoying, even more with complex queries

bastien-snk avatar Oct 09 '25 11:10 bastien-snk