yarricharY
Convex Community3y ago
9 replies
yarrichar

Multiple vector indexes on the same table

I have a bunch of embeddings stored in a table. I want to be able to filter those on different columns depending on the scenario. I assume I'm meant to create two different vectorIndex's. But I keep getting the error when I try:
400 Bad Request: IndexFieldsNotUnique: Hit an error while evaluating your schema:
Index fields must be unique within an index.

The indexes I have on that table are:
        .vectorIndex("by_embedding", {
            vectorField: "embedding",
            dimensions: 1536,
            filterFields: ["clerkUserId"],
        })
        .vectorIndex("by_embedding_doc", {
            vectorField: "embedding",
            dimensions: 1536,
            filterFields: ["documentId"],
        }),


If I remove the second vectorIndex then it works. Any ideas what I'm doing wrong?
Was this page helpful?