Go SDK Quickstart
Get started with the Endee Go SDK to build high-performance vector search applications. This guide will walk you through installation, setup, and creating your first index.
Requirements
- Go 1.24.5 or higher
- Endee Local server running (see Quick Start)
New to Endee? Set up your local environment first by following the Quick Start Guide.
Installation
Install the Go client using go get:
go get github.com/endee-io/endee-go-clientSetup Endee and Create Index
Initialize the Client
The Endee client is the main interface for all vector operations. Initialize it to connect to your local server:
package main
import "github.com/endee-io/endee-go-client"
func main() {
// Connect to local Endee server (defaults to localhost:8080)
client := endee.EndeeClient("")
}Using Authentication? If your server has NDD_AUTH_TOKEN set, pass the
same token when initializing: client := endee.EndeeClient("your-auth-token")
See Authentication for details.
Create a Dense Index
Create a vector index for semantic similarity search:
package main
import (
"log"
"github.com/endee-io/endee-go-client"
)
func main() {
client := endee.EndeeClient("")
err := client.CreateIndex(
"my_vectors", // name
384, // dimension
"cosine", // space_type
16, // M
128, // ef_con
endee.PrecisionInt8D, // precision
nil, // version (optional)
0, // sparse_dim (0 for dense-only)
)
if err != nil {
log.Fatal(err)
}
}Dense Index Parameters:
| Parameter | Description |
|---|---|
name | Unique name for your index (alphanumeric + underscore, max 48 chars) |
dimension | Vector dimensionality (must match your embedding model’s output, max 10,000) |
spaceType | Distance metric - "cosine", "l2", or "ip" (see Constants) |
M | Graph connectivity - higher values increase recall but use more memory (default: 16) |
efCon | Construction-time parameter - higher values improve index quality (default: 128) |
precision | Quantization precision (default: PrecisionFloat8D) - see Precision |
version | Optional version parameter for index versioning |
sparseDim | Sparse vector dimension (0 for dense-only) |
Create a Hybrid Index
Hybrid indexes combine dense vector search with sparse vector search for improved retrieval. Set the sparseDim parameter to enable hybrid search:
err := client.CreateIndex(
"hybrid_index", // name
384, // dimension
"cosine", // space_type
16, // M
128, // ef_con
endee.PrecisionInt8D, // precision
nil, // version
30000, // sparse_dim (vocabulary size)
)Additional Hybrid Parameter:
| Parameter | Description |
|---|---|
sparseDim | Sparse vector dimension (e.g., vocabulary size for SPLADE) |
List and Access Indexes
// List all indexes
indexes, err := client.ListIndexes()
// Get reference to an existing index
index, err := client.GetIndex("my_vectors")
// Delete an index
err = client.DeleteIndex("my_vectors")Complete Example
Here’s a complete example putting it all together:
package main
import (
"fmt"
"log"
"github.com/endee-io/endee-go-client"
)
func main() {
// Initialize client
client := endee.EndeeClient("")
// Create a dense index
err := client.CreateIndex(
"documents", 384, "cosine", 16, 128,
endee.PrecisionInt8D, nil, 0,
)
if err != nil {
log.Fatal(err)
}
// Get the index
index, err := client.GetIndex("documents")
if err != nil {
log.Fatal(err)
}
// Add vectors
vectors := []endee.VectorItem{
{
ID: "doc1",
Vector: []float32{0.1, 0.2, 0.3 /* ... */},
Meta: map[string]interface{}{"title": "First Document"},
Filter: map[string]interface{}{"category": "tech"},
},
{
ID: "doc2",
Vector: []float32{0.3, 0.4, 0.5 /* ... */},
Meta: map[string]interface{}{"title": "Second Document"},
Filter: map[string]interface{}{"category": "science"},
},
}
err = index.Upsert(vectors)
if err != nil {
log.Fatal(err)
}
// Query the index
queryVector := []float32{0.15, 0.25 /* ... */}
results, err := index.Query(queryVector, nil, nil, 5, nil, 128, false)
if err != nil {
log.Fatal(err)
}
for _, item := range results {
fmt.Printf("ID: %s, Similarity: %.3f\n", item.ID, item.Similarity)
}
}Next Steps
Now that you have your index set up, learn how to: