redisredisearch

How to use INKEYS to filter by the key/document_id?


I am trying to create a search query with redis and filter based on the id of the document. It seems we need to use the INKEYS command, but it doesn't work for the key ru203:book:details:9780002005883 even after escaping the :.

The command "FT.SEARCH" "books-idx" "@author_ids:{1 | 2} INKEYS 1 ru203\\:book\\:details\\:9780002005883" "NOCONTENT" "LIMIT" "0" "10000" doesn't return anything. Am I using the command correctly?

empty result

result with 2 documents

(without the INKEYS part, 2 documents are returned)

Edit: the method in redis-py is Query.limit_ids


Solution

  • Redis Insight interprets all inserted characters as part of the query, including optional arguments such as INKEYS or LIMIT. To use optional arguments, you can try Workbench. It also offers syntax auto-completion for Redis Query Engine.