Skip to main content

Drop predicate index

Remove a predicate index when it's no longer needed or to reduce storage overhead.

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
storestringStore to modify.
predicateslistMetadata fields whose indexes should be dropped.
error_if_not_existsbool · optionalIf true, errors when the index doesn't exist.
schemastring · optionalSchema to target. Defaults to public.

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

Behavior

  • Deletes the index only — the underlying entries and metadata remain.
  • Queries on the field still work, just without the index speed-up.

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.db.server import Del


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

response = await client.drop_pred_index(
db_query.DropPredIndex(
store="my_store",
schema="analytics",
predicates=["label"],
error_if_not_exists=True
)
)
# response.deleted_count shows how many indexes were removed
print(response)


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

Response

The number of indexes deleted.