mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-07 11:58:31 +02:00
39 lines
887 B
Go
39 lines
887 B
Go
package snippet
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/qdrant/go-client/qdrant"
|
|
)
|
|
|
|
func Main() {
|
|
client, err := qdrant.NewClient(&qdrant.Config{
|
|
Host: "localhost",
|
|
Port: 6334,
|
|
})
|
|
|
|
if err != nil { panic(err) } // @hide
|
|
|
|
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
|
CollectionName: "chunks",
|
|
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
|
Size: 4,
|
|
Distance: qdrant.Distance_Cosine,
|
|
}),
|
|
})
|
|
|
|
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
|
CollectionName: "chunks",
|
|
FieldName: "document_id",
|
|
FieldType: qdrant.FieldType_FieldTypeInteger.Enum(),
|
|
})
|
|
|
|
// No vectors, payload only.
|
|
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
|
CollectionName: "documents",
|
|
VectorsConfig: qdrant.NewVectorsConfigMap(
|
|
map[string]*qdrant.VectorParams{},
|
|
),
|
|
})
|
|
}
|