Skip to main content

Drop Predicate Index

The DropPredIndex request removes an existing predicate index from a store.

  • Input: Store name, list of predicate keys to remove, and error handling flag.

  • Behavior: Removes the specified predicate indices.

  • Response: Confirmation of index removal.

Click to expand source code
import { createDbClient } from "ahnlich-client-node";
import { DropPredIndex } from "ahnlich-client-node/grpc/db/query_pb";

async function dropPredicateIndex() {
const client = createDbClient("127.0.0.1:1369");

await client.dropPredIndex(
new DropPredIndex({
store: "my_store",
predicates: ["label"],
errorIfNotExists: true,
})
);

console.log("Predicate index dropped successfully");
}

dropPredicateIndex();

Parameters​

ParameterTypeRequiredDescription
storestringYesThe name of the store
predicatesstring[]YesList of predicate indices to remove
errorIfNotExistsbooleanNoIf true, throws error if index doesn't exist

Notes​

  • Dropping an index does not delete the underlying data
  • After dropping, predicate queries on that field will be slower (full scan)
  • Consider keeping indices for frequently filtered fields