Skip to main content

Drop Non Linear Algorithm Index

Schema​

This request accepts an optional schema field. When it is omitted, the server uses the public schema. Set schema to target a store in another schema.

The DropNonLinearAlgorithmIndex request removes a non-linear index (HNSW) from a store.

  • Input: Store name, list of index types to remove, and error handling flag.

  • Behavior: Removes the specified non-linear indices.

  • Response: Confirmation of index removal.

Click to expand source code
TypeScript
import { createDbClient } from "ahnlich-client-node";
import { DropNonLinearAlgorithmIndex } from "ahnlich-client-node/grpc/db/query_pb";
import { NonLinearAlgorithm } from "ahnlich-client-node/grpc/algorithm/nonlinear_pb";

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

await client.dropNonLinearAlgorithmIndex(
new DropNonLinearAlgorithmIndex({
store: "my_store",
schema: "analytics",
nonLinearIndices: [NonLinearAlgorithm.HNSW],
errorIfNotExists: true,
})
);

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

dropNonLinearIndex();

Parameters​

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

Available NonLinearAlgorithm Values​

ValueDescription
NonLinearAlgorithm.HNSWHierarchical Navigable Small World

Notes​

  • Dropping an index does not delete the underlying data
  • Similarity searches will fall back to linear scan after dropping indices
  • You may want to rebuild indices with different configurations