Commands

Upsert

Used to add new documents or update an existing document.

You can only upsert documents with the same structure as defined in your database.

Arguments

DocumentPayloadDocument | Document[]required

Response

strrequired

'Success' on successful operation.

Single Document
await index.upsert({  id: "star-wars",  content: { title: "Star Wars", genre: "sci-fi" },  metadata: { year: 1977 }});
Multiple Documents
await index.upsert([  {    id: "inception",    content: { title: "Inception", genre: "action" }    metadata: {      year: 2010,    },  },  { ... },]);
Update Document
await index.upsert({  id: "star-wars",  content: {    title: "Star Wars: Episode IV - A New Hope",    genre: "sci-fi"  },});
Loading search…