Skip to main content

Drop Non Linear Algorithm Index

Removes a non-linear index (KDTree or HNSW) from an AI store.

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

async function dropNonLinearIndex() {
const client = createAiClient("127.0.0.1:1370");

await client.dropNonLinearAlgorithmIndex(
new DropNonLinearAlgorithmIndex({
store: "ai_store",
nonLinearIndices: [NonLinearAlgorithm.KDTree],
errorIfNotExists: true,
})
);

console.log("KDTree index dropped");
}

dropNonLinearIndex();

Parameters​

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