Skip to main content

Create Predicate Index

Creates an index on metadata fields to optimize predicate-based queries in an AI store.

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

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

await client.createPredIndex(
new CreatePredIndex({
store: "ai_store",
predicates: ["brand", "category"],
})
);

console.log("Predicate indices created");
}

createPredicateIndex();

Parameters​

ParameterTypeRequiredDescription
storestringYesThe name of the AI store
predicatesstring[]YesList of metadata keys to index