Skip to contents

Upserts records with text that gets automatically embedded using the index's integrated embedding model. This is only available for indexes created with `create_index_for_model()`.

Usage

records_upsert(index, records, namespace = "")

Arguments

index

Name of the index (must have integrated embedding model)

records

A list of records to upsert. Each record should be a named list with: - `_id`: Unique identifier for the record - Additional fields including the text field specified in the index's field_map

namespace

Namespace to upsert into (default: "")

Value

List with http response, content (upserted count), and status_code

Details

The index must be created with `create_index_for_model()` which configures an integrated embedding model. The text field specified in the index's `field_map` will be automatically embedded.

Examples

if (FALSE) { # \dontrun{
# First create an index with integrated embedding
create_index_for_model(
  name = "my-index",
  cloud = "aws",
  region = "us-east-1",
  embed = list(
    model = "multilingual-e5-large",
    field_map = list(text = "chunk_text")
  )
)

# Then upsert records with text (automatically embedded)
records_upsert(
  index = "my-index",
  records = list(
    list(`_id` = "rec1", chunk_text = "The quick brown fox"),
    list(`_id` = "rec2", chunk_text = "jumps over the lazy dog")
  )
)

# With additional metadata
records_upsert(
  index = "my-index",
  records = list(
    list(
      `_id` = "doc1",
      chunk_text = "Machine learning is transforming industries",
      category = "tech",
      source = "article"
    )
  )
)
} # }