You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
c := redisearch.NewClient("localhost:6379", "idx:title")
// Create a schema
sc := redisearch.NewSchema(redisearch.DefaultOptions).
AddField(redisearch.NewTextFieldOptions("$.Title", redisearch.TextFieldOptions{As: "title"}))
// Drop an existing index. If the index does not exist an error is returned
err = c.Drop()
// Create the index with the given schema and definition
id := &redisearch.IndexDefinition{IndexOn: "JSON", Score: -1.0}
if err := c.CreateIndexWithIndexDefinition(sc, id); err != nil {
log.Fatalln(err)
}
To have As in FieldOptions you have to use master branch since it is not yet released in last version:
go get github.com/RediSearch/redisearch-go/redisearch@master
Is it possible to create an index using ON JSON SCHEMA as I do in Redis using Redisearch + RedisJSON together?
Example:
FT.CREATE idx:title ON JSON SCHEMA $.Title AS title TEXT
The text was updated successfully, but these errors were encountered: