A Go client library for Quickwit, a cloud-native search engine.
- ✅ Full Quickwit API support
- ✅ Index management (create, list, get, delete, clear, describe)
- ✅ Source management (create, delete)
- ✅ Search operations
- ✅ Split operations
- ✅ Cluster health checks
- ✅ Elasticsearch-compatible endpoint
- ✅ Comprehensive test suite with Testcontainers
go get github.com/CleverCloud/quickwit-gopackage main
import (
"context"
"log"
quickwit "github.com/CleverCloud/quickwit-go"
)
func main() {
// Create a new client
client := quickwit.New(
quickwit.WithEndpoint("http://localhost:7280"),
)
ctx := context.Background()
// Create an index
indexConfig := quickwit.IndexConfig{
Version: "0.9",
ID: "my-index",
DocMapping: quickwit.DocMapping{
Mode: "dynamic",
FieldMappings: []quickwit.FieldMapping{
{
Name: "message",
Type: "text",
Indexed: true,
Stored: true,
},
},
},
IndexingSettings: quickwit.Settings{
Resources: quickwit.Resources{
HeapSize: "100MB",
},
},
SearchSettings: quickwit.SearchSettings{
DefaultSearchFields: []string{"message"},
},
}
index, err := client.CreateIndex(ctx, indexConfig)
if err != nil {
log.Fatal(err)
}
log.Printf("Created index: %s", index.Config.ID)
// Search
results, err := client.Search(ctx, "my-index", "*")
if err != nil {
log.Fatal(err)
}
log.Printf("Found %d results", results.NumHits)
}// With custom endpoint
client := quickwit.New(
quickwit.WithEndpoint("http://quickwit.example.com:7280"),
)
// With authentication
client := quickwit.New(
quickwit.WithEndpoint("http://quickwit.example.com:7280"),
quickwit.WithBearerToken("your-token"),
)
// With basic auth
client := quickwit.New(
quickwit.WithEndpoint("http://quickwit.example.com:7280"),
quickwit.WithBasicAuth("username", "password"),
)
// With custom HTTP client
httpClient := &http.Client{Timeout: 30 * time.Second}
client := quickwit.New(
quickwit.WithHttpClient(httpClient),
)
// With logger
logger := logrus.New()
client := quickwit.New(
quickwit.WithLogger(logger),
)GetCluster()- Get cluster informationGetElastic()- Get Elasticsearch-compatible endpoint info
CreateIndex(ctx, config)- Create a new indexListIndexes(ctx)- List all indexesGetIndex(ctx, indexID)- Get a specific indexDeleteIndex(ctx, indexID)- Delete an indexClearIndex(ctx, indexID)- Clear all data from an indexDescribeIndex(ctx, indexID)- Get index statisticsListSplits(ctx, indexID)- List index splits
CreateSource(ctx, indexID, config)- Create a data sourceDeleteSource(ctx, indexID, sourceID)- Delete a source
Search(ctx, indexID, query)- Execute a search query
The library includes comprehensive integration tests using Testcontainers.
# Run tests
go test -v ./...
# Run tests with coverage
go test -v -race -coverprofile=coverage.out ./...
# Run tests with container logs
CONTAINER_LOG=true go test -v ./...See TESTING.md for more details.
- Go 1.24+
- Docker (for integration tests)
# Install dependencies
go mod download
# Run all tests
go test -v ./...
# Run linter
golangci-lint runContributions are welcome! Please feel free to submit a Pull Request.