Request specific fields (not all fields) with RediSearch

1.1k Views Asked by At

Here's an official example of a RediSearch query:

127.0.0.1:6379> FT.SEARCH myIdx "hello world" LIMIT 0 10
1) (integer) 1
2) "doc1"
3) 1) "title"
   2) "hello world"
   3) "body"
   4) "lorem ipsum"
   5) "url"
   6) "http://redis.io"

My question is, how could I request just one or two fields, e.g. just to get back to the "title" value ("hello world") or the "ID" and "title" fields ([1, "hello world"]). Mainly for performance reasons.

1

There are 1 best solutions below

3
On BEST ANSWER

Yes, it supports it with the RETURN option.

127.0.0.1:6379> FT.SEARCH myIdx "hello world" LIMIT 0 10 RETURN 2 title url

See: https://oss.redislabs.com/redisearch/Commands/#ftsearch