CREATE INDEX FOR is not recognized as a query

I want to create an index on 4 properties of my User type.
Below is my query which I’m trying to run. It failed both through the js client and RedisInsight:

GRAPH.QUERY social "CREATE INDEX FOR (u:User) ON (u.id, u,username, u.firstname, u.lastname)"

This is the error message I’m getting:

"errMsg: Invalid input 'F': expected '=' or CREATE INDEX ON line: 1, column: 14, offset: 13 errCtx: CREATE INDEX FOR (u:User) ON (u.id, u,username, u.firstname, u.lastname) errCtxOffset: 13"

The error indicates the the CREATE INDEX FOR statement is not being recognized but instead it suggests CREATE INDEX ON even though in the docs it is marked as deprecated.

I run Redisgraph through docker compose and also the latest image.

redisgraph:
  image: redislabs/redisgraph:latest
  container_name: redisgraph
  networks:
    - basenet
  volumes:
    - ./docker-data/redisgraph:/data
  ports:
    - 6379:6379
  restart: on-failure

I’m probably experiencing the same as described in this issue

Hi @jonas_levin, the new index creation syntax is only available at the moment on our edge docker image, it has yet to be released, @jeffreylovitz can you please update the documentation?

Regardless, you can still use the old syntax to create an index over multiple attributes.

1 Like