await index.upsert({
  id: "1234",
  vector: [0.1, 0.2, 0.3, 0.4, 0.5],
  metadata: {
    title: "Lord of The Rings",
    genre: "drama",
    category: "classic",
  },
});

Used to add new vectors or update an existing vector.

You can only upsert vectors with same dimension count(size) as your index.

Arguments

There are two ways to use the upsert method. You can either create the vectors on your own and pass directly the vector. Or you can pass the data and create the embeddings using Upstash Embedding. The possible payloads are:

VectorPayload
Vector | Vector[]

OR

DataPayload
Data | Data[]

Response

'Success' on successful operation.

await index.upsert({
  id: "1234",
  vector: [0.1, 0.2, 0.3, 0.4, 0.5],
  metadata: {
    title: "Lord of The Rings",
    genre: "drama",
    category: "classic",
  },
});