Skip to main content

Delete by key

Delete entries by an exact vector-key match.

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

ParameterTypeDescription
storestringName of the store to delete from.
keyslist of vectorsThe exact vector keys to remove.
schemastring · optionalSchema to target. Defaults to public.

All requests accept an optional schema field. When omitted, the server uses the public schema.

Behavior

  • Removes only the entries whose key matches exactly.
  • Keys that aren't present are silently ignored.

Sample query

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
from ahnlich_client_py.grpc import keyval


async def delete_key():
async with Channel(host="127.0.0.1", port=1369) as channel:
client = DbServiceStub(channel)

store_key = keyval.StoreKey(key=[1.0, 2.0, 3.0, 4.0])

response = await client.del_key(
db_query.DelKey(
store="my_store",
schema="analytics",
keys=[store_key]
)
)
# response.deleted_count shows how many items were deleted
print(response)



if __name__ == "__main__":
asyncio.run(delete_key())

Response

The number of entries deleted.