This page shows you how to upsert documents into a collection.

LAMBDADB_PROJECT_API_KEY="YOUR_API_KEY"

curl -X POST \
  "https://{baseUrl}/projects/{projectName}/collections/{collectionName}/docs/upsert" \
  -H 'content-type: application/json
  -H 'x-api-key: $LAMBDADB_PROJECT_API_KEY' \
  -d '{
    "docs": [
      {
        "id": "33201222",
        "url": "https://en.wikipedia.org/wiki/LambdaDB",
        "title": "LambdaDB",
        "text": "LambdaDB is a serverless-native search engine for AI... ",
        "dense_vector" : [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0],
        "sparse_vector" : [{"LambdaDB" : 0.83}, {"is" : 0.1}, {"a" : 0.1} ... {"AI" : 0.7} ...]
      },
      {
        "url": "https://en.wikipedia.org/wiki/Winamp",
        "title": "Winamp",
        "text": "Winamp is a media player for Windows, macOS and Android ..."
        "dense_vector" : [1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0],
        // If you want to use index-based format, simply use index numbers as keys in the sparse vector
        "sparse_vector" : [{"0" : 0.8}, {"4" : 0.1}, {"11" : 0.1}, {"63" : 0.54} ...]
      }
    ]
  }'

Each document implicitly contains an id field in order to uniquely identify a document. A unique string value is auto-generated by the system if id field is not provided in an upsert request. If you want to overwrite the entire document, you can do so by providing the id field in the document.

Upsert limits

MetricLimit
Max payload size6MB
Max length for a document ID512 characters
Max vector dimensions4,096
Max document size50KB

When upserting larger amounts of data, it is recommended to use bulk-upsert operation.