Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unknown command 'FT.CREATE' #1284

Closed
Tameenk opened this issue Nov 21, 2019 · 14 comments
Closed

unknown command 'FT.CREATE' #1284

Tameenk opened this issue Nov 21, 2019 · 14 comments

Comments

@Tameenk
Copy link

Tameenk commented Nov 21, 2019

i got error unknown command 'FT.CREATE' when trying to create index

this is my code

Client client = new Client("testIndex", database);
Schema sc = new Schema()
.AddTextField("Id", 1.0)
.AddTextField("Name", 5.0)
.AddTextField("Country", 1.0)
.AddTextField("City", 1.0);
client.CreateIndex(sc, Client.IndexOptions.Default);

        for (int i = 0; i < 300; i++)
        {
            Dictionary<String, RedisValue> fields = new Dictionary<String, RedisValue>();
            fields.Add("Id", i+1);
            fields.Add("Name", "Name " + i+1);
            fields.Add("Country", "Country " + i +1);
            fields.Add("City", "City " + i+1);
            client.AddDocument("d1", fields);
        }
@gkorland
Copy link
Contributor

gkorland commented Nov 21, 2019

It seems like your Redis doesn't have the RediSearch module loaded. See http://redisearch.io

@Tameenk
Copy link
Author

Tameenk commented Nov 21, 2019

@gkorland I'm using .net core 2.2 and i have installed StackExchange.Redis & NRediSearch is there any other package ?

@gkorland
Copy link
Contributor

I'm talking about the Redis Server you're connecting to, it seems like the server doesn't have RediSearch module loaded.

The quickest way to run Redis server with the ReidSearch module loaded is just run the docker container this way you can verify if that was the issue.

docker run -p 6379:6379 redislabs/redisearch:latest

@Tameenk
Copy link
Author

Tameenk commented Nov 21, 2019

@gkorland thanks it works now with docker image , so my question now how can i add this module on windows ?

@gkorland
Copy link
Contributor

do you run the redis server on windows?

@Tameenk
Copy link
Author

Tameenk commented Nov 21, 2019

yes i did

@gkorland
Copy link
Contributor

@Tameenk
Copy link
Author

Tameenk commented Nov 21, 2019

I already have installed redis server on windows 10 but i just need to add redis search module

@mgravell
Copy link
Collaborator

There are 2 ways to load a module; you can call the MODULE LOAD command against the server, or you add the module to the server's config file. Bother are mentioned here: https://redis.io/commands/module-load

I'm going to close this down, simply because it isn't really a library concern (other than to point you in the right direction)

@gyana12
Copy link

gyana12 commented May 18, 2020

hi All, i was trying to install RedisSearch module but don't how to do that, Using below command
redis-cli --cluster call 127.0.0.1:30001 MODULE LOAD redisearch.so OPT1 OPT2

someone told me what would be value for OPT1 and OPT2

@roppa
Copy link

roppa commented May 21, 2020

In docker compose I'm using redislabs/redisearch:latest. Yet when I run FT.CREATE myIdx SCHEMA title TEXT WEIGHT 5.0 body TEXT url TEXT value NUMERIC I get ERR unknown command FT.CREATE

@mgravell
Copy link
Collaborator

mgravell commented May 21, 2020

The command is still FT.CREATE, so: if it isn't working, it sounds like a problem with the docker setup. Is that your local setup, or one of ours?

@roppa
Copy link

roppa commented May 21, 2020

This is very strange. I was using docker-compose:

version: '3.2'
services:
  redis:
    image: 'redislabs/redisearch:latest'
    command: redis-server
    ports:
      - '6379:6379'

running command module list I got an empty list. Then using docker for the same image, it works. 🤔

@samifouad
Copy link

samifouad commented Mar 16, 2021

Because this is still an issue with RediSearch 2.0 w/ docker, and this page comes up in Google:

if you look at the default docker files for RediSearch, it launches search module as a Docker CMD arg

In my testing, it seems like adding your own config file will for some reason make Docker ignore the CMD arg to launch the search module

The quick fix for this is two options:

  1. add extra 'loadmodule' command to docker run
    docker run -d --rm -p 6379:6379 -v /var/redis/data:/data -v /var/redis/redis.conf:/usr/local/etc/redis/redis.conf --name redis redislabs/redisearch:latest redis-server /usr/local/etc/redis/redis.conf --loadmodule /usr/lib/redis/modules/redisearch.so

OR

  1. add 'loadmodule' in your custom redis.config:
    loadmodule /usr/lib/redis/modules/redisearch.so

Running module list command inside redis-cli will now show you search is loaded with either of these methods

I honestly think this is more of a Docker issue than a Redis issue, so not much can be done to solve it by Redis team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants