Skip to content
Go client for RediSearch
Branch: master
Clone or download
Latest commit 868a31a Apr 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Update config.yml Mar 14, 2019
redisearch Fixed import Apr 14, 2019
.gitignore add ci Jan 28, 2019
LICENSE Initial commit Jul 26, 2017 fix import Mar 20, 2019 reformat doc and add a script to generate them Nov 16, 2017

license CircleCI GitHub issues Codecov Go Report Card GoDoc

RediSearch Go Client

Go client for RediSearch, based on redigo.


go get

Usage Example

import (


func ExampleClient() {

	// Create a client. By default a client is schemaless
	// unless a schema is provided when creating the index
	c := redisearch.NewClient("localhost:6379", "myIndex")

	// Create a schema
	sc := redisearch.NewSchema(redisearch.DefaultOptions).
		AddField(redisearch.NewTextFieldOptions("title", redisearch.TextFieldOptions{Weight: 5.0, Sortable: true})).

	// Drop an existing index. If the index does not exist an error is returned

	// Create the index with the given schema
	if err := c.CreateIndex(sc); err != nil {

	// Create a document with an id and given score
	doc := redisearch.NewDocument("doc1", 1.0)
	doc.Set("title", "Hello world").
		Set("body", "foo bar").
		Set("date", time.Now().Unix())

	// Index the document. The API accepts multiple documents at a time
	if err := c.Index([]redisearch.Document{doc}...); err != nil {

	// Searching with limit and sorting
	docs, total, err := c.Search(redisearch.NewQuery("hello world").
		Limit(0, 2).

	fmt.Println(docs[0].Id, docs[0].Properties["title"], total, err)
	// Output: doc1 Hello world 1 <nil>
You can’t perform that action at this time.