Skip to main content

Drop Non Linear Algorithm Index

The DropNonLinearAlgorithmIndex request removes a non-linear index (KDTree or 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
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",
nonLinearIndices: [NonLinearAlgorithm.KDTree],
errorIfNotExists: true,
})
);

console.log("KDTree 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.KDTreeK-dimensional tree
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