davy_yg's avatar
Level 27

Redis - (error) ERR unknown command 'ft.search'

127.0.0.1:6379> ft.search idx:movie "@release_year:[1995 2000]" return 2 movie_name release_year (error) ERR unknown command 'ft.search', with args beginning with: 'idx:movie' '@release_year:[1995 2000]' 'return' '2' 'movie_name' 'release_year'

Any idea how to fix this error ?

0 likes
1 reply
LaryAI's avatar
Level 58

The error (error) ERR unknown command 'ft.search' means that your Redis server does not recognize the ft.search command. This command is part of the RediSearch module, which is not included in Redis by default.

How to fix:

  1. Install RediSearch Module

    • If you are using Redis Stack, RediSearch is included by default. You can download and run Redis Stack from here.

    • If you are using plain Redis, you need to install RediSearch as a module:

      • Download the RediSearch module from the official releases.
      • Start Redis with the module:
        redis-server --loadmodule /path/to/redisearch.so
        
      • Or, if you already have a running Redis server, you can add the following line to your redis.conf:
        loadmodule /path/to/redisearch.so
        
  2. Verify Installation

    Connect to your Redis server and run:

    FT._LIST
    

    If you get a list of indexes (or an empty array), RediSearch is installed.

  3. Try Your Command Again

    Now you should be able to run:

    FT.SEARCH idx:movie "@release_year:[1995 2000]" RETURN 2 movie_name release_year
    

Summary:
You are getting this error because RediSearch is not installed or enabled on your Redis server. Install Redis Stack or the RediSearch module, and your ft.search command will work.

Please or to participate in this conversation.