Get a store
Return detailed information about a single store by name.
Every operation works on both Vector DB stores (you supply raw vectors) and AI stores (you supply text or images and Ahnlich AI generates the embeddings for you). Use the Vector DB / AI switch in the sample below.
Parameters
| Parameter | Type | Description |
|---|---|---|
store | string | Name of the store to inspect. |
schema | string · optional | Schema to target. Defaults to public. |
All requests accept an optional
schemafield. When omitted, the server uses thepublicschema.
Behavior
- Retrieves metadata and configuration for the named store.
Sample query
- Database engine
- AI proxy
- Python
- Node.js
- Go
- Rust
- CLI
Python
import asyncio
from grpclib.client import Channel
from ahnlich_client_py.grpc.services.db_service import DbServiceStub
from ahnlich_client_py.grpc.db import query as db_query
async def get_store_info():
async with Channel(host="127.0.0.1", port=1369) as channel:
client = DbServiceStub(channel)
response = await client.get_store(
db_query.GetStore(store="my_store", schema="analytics")
)
print(f"Store name: {response.name}")
print(f"Number of entries: {response.len}")
print(f"Size in bytes: {response.size_in_bytes}")
print(f"Dimension: {response.dimension}")
print(f"Predicate indices: {response.predicate_indices}")
print(f"Non-linear indices: {response.non_linear_indices}")
if __name__ == "__main__":
asyncio.run(get_store_info())
TypeScript
import { createDbClient } from "ahnlich-client-node";
import { GetStore } from "ahnlich-client-node/grpc/db/query_pb";
async function getStore() {
const client = createDbClient("127.0.0.1:1369");
const response = await client.getStore(
new GetStore({ store: "my_store", schema: "analytics" })
);
console.log(response.name); // Store name
console.log(response.dimension); // Vector dimension
console.log(response.predicateIndices); // Indexed predicate keys
console.log(response.nonLinearIndices); // Non-linear algorithm indices
console.log(response.len); // Number of entries
console.log(response.sizeInBytes); // Size on disk
}
getStore();
Go
package main
import (
"context"
"fmt"
"log"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
dbsvc "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/services/db_service"
dbquery "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/db/query"
)
const ServerAddr = "127.0.0.1:1369"
func stringPtr(value string) *string { return &value }
type ExampleDBClient struct {
conn *grpc.ClientConn
client dbsvc.DBServiceClient
ctx context.Context
}
func NewDBClient(ctx context.Context) (*ExampleDBClient, error) {
conn, err := grpc.NewClient(ServerAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, fmt.Errorf("failed to dial DB server %q: %w", ServerAddr, err)
}
client := dbsvc.NewDBServiceClient(conn)
return &ExampleDBClient{conn: conn, client: client, ctx: ctx}, nil
}
func (c *ExampleDBClient) Close() error {
return c.conn.Close()
}
func (c *ExampleDBClient) exampleGetStore() error {
resp, err := c.client.GetStore(c.ctx, &dbquery.GetStore{
Store: "my_store",
Schema: stringPtr("analytics"), // Optional: defaults to public when omitted
})
if err != nil {
return err
}
fmt.Printf("Store name: %s\n", resp.Name)
fmt.Printf("Number of entries: %d\n", resp.Len)
fmt.Printf("Size in bytes: %d\n", resp.SizeInBytes)
fmt.Printf("Dimension: %d\n", resp.Dimension)
fmt.Printf("Predicate indices: %v\n", resp.PredicateIndices)
fmt.Printf("Non-linear indices: %v\n", resp.NonLinearIndices)
return nil
}
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client, err := NewDBClient(ctx)
if err != nil {
log.Fatalf("Failed to create DB client: %v", err)
}
defer client.Close()
if err := client.exampleGetStore(); err != nil {
log.Fatalf("GetStore failed: %v", err)
}
}
Rust
use ahnlich_client_rs::db::DbClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let db_client = DbClient::new("127.0.0.1:1369".to_string()).await?;
let tracing_id: Option<String> = None;
let store_info = db_client
.get_store_with_schema(
"my_store".to_string(),
Some("analytics".to_string()),
tracing_id,
)
.await?;
println!("Store name: {}", store_info.name);
println!("Number of entries: {}", store_info.len);
println!("Size in bytes: {}", store_info.size_in_bytes);
println!("Dimension: {}", store_info.dimension);
println!("Predicate indices: {:?}", store_info.predicate_indices);
println!("Non-linear indices: {:?}", store_info.non_linear_indices);
Ok(())
}
This operation isn't exposed as a standalone CLI command — use one of the client libraries above.
- Python
- Node.js
- Go
- Rust
- CLI
Python
import asyncio
from grpclib.client import Channel
from ahnlich_client_py.grpc.services.ai_service import AiServiceStub
from ahnlich_client_py.grpc.ai import query as ai_query
async def get_ai_store_info():
async with Channel(host="127.0.0.1", port=1370) as channel:
client = AiServiceStub(channel)
response = await client.get_store(
ai_query.GetStore(store="ai_store", schema="analytics")
)
print(f"Store name: {response.name}")
print(f"Query model: {response.query_model}")
print(f"Index model: {response.index_model}")
print(f"Embedding size: {response.embedding_size}")
print(f"Dimension: {response.dimension}")
print(f"Predicate indices: {response.predicate_indices}")
if response.db_info:
print(f"DB store size: {response.db_info.size_in_bytes} bytes")
if __name__ == "__main__":
asyncio.run(get_ai_store_info())
TypeScript
import { createAiClient } from "ahnlich-client-node";
import { GetStore } from "ahnlich-client-node/grpc/ai/query_pb";
async function getStore() {
const client = createAiClient("127.0.0.1:1370");
const response = await client.getStore(
new GetStore({ store: "ai_store", schema: "analytics" })
);
console.log(response.name); // Store name
console.log(response.queryModel); // AI model used for querying
console.log(response.indexModel); // AI model used for indexing
console.log(response.embeddingSize); // Number of stored embeddings
console.log(response.dimension); // Vector dimension
console.log(response.predicateIndices); // Indexed predicate keys
console.log(response.dbInfo); // Optional DB store info
}
getStore();
Go
package main
import (
"context"
"fmt"
"log"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
aisvc "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/services/ai_service"
aiquery "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/ai/query"
)
const AIAddr = "127.0.0.1:1370"
func stringPtr(value string) *string { return &value }
type ExampleAIClient struct {
conn *grpc.ClientConn
client aisvc.AIServiceClient
ctx context.Context
}
func NewAIClient(ctx context.Context) (*ExampleAIClient, error) {
conn, err := grpc.DialContext(ctx, AIAddr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
if err != nil {
return nil, fmt.Errorf("failed to dial AI server %q: %w", AIAddr, err)
}
client := aisvc.NewAIServiceClient(conn)
return &ExampleAIClient{conn: conn, client: client, ctx: ctx}, nil
}
func (c *ExampleAIClient) Close() error {
return c.conn.Close()
}
func (c *ExampleAIClient) exampleGetStore() error {
resp, err := c.client.GetStore(c.ctx, &aiquery.GetStore{
Store: "ai_store",
Schema: stringPtr("analytics"), // Optional: defaults to public when omitted
})
if err != nil {
return err
}
fmt.Printf("Store name: %s\n", resp.Name)
fmt.Printf("Query model: %v\n", resp.QueryModel)
fmt.Printf("Index model: %v\n", resp.IndexModel)
fmt.Printf("Embedding size: %d\n", resp.EmbeddingSize)
fmt.Printf("Dimension: %d\n", resp.Dimension)
fmt.Printf("Predicate indices: %v\n", resp.PredicateIndices)
if resp.DbInfo != nil {
fmt.Printf("DB store size: %d bytes\n", resp.DbInfo.SizeInBytes)
}
return nil
}
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client, err := NewAIClient(ctx)
if err != nil {
log.Fatalf("Failed to create AI client: %v", err)
}
defer client.Close()
if err := client.exampleGetStore(); err != nil {
log.Fatalf("GetStore failed: %v", err)
}
}
Rust
use ahnlich_client_rs::ai::AiClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let ai_client = AiClient::new("127.0.0.1:1370".to_string()).await?;
let tracing_id: Option<String> = None;
let store_info = ai_client
.get_store_with_schema(
"ai_store".to_string(),
Some("analytics".to_string()),
tracing_id,
)
.await?;
println!("Store name: {}", store_info.name);
println!("Query model: {:?}", store_info.query_model);
println!("Index model: {:?}", store_info.index_model);
println!("Embedding size: {}", store_info.embedding_size);
println!("Dimension: {}", store_info.dimension);
println!("Predicate indices: {:?}", store_info.predicate_indices);
if let Some(db_info) = &store_info.db_info {
println!("DB store size: {} bytes", db_info.size_in_bytes);
}
Ok(())
}
This operation isn't exposed as a standalone CLI command — use one of the client libraries above.
Response
Store information including name, size, dimension, and configured indices.