upload_documents: Upload documents

View source: R/index.R

upload_documentsR Documentation

Upload documents

Description

Upload documents

Usage

upload_documents(
  index,
  documents,
  columns = NULL,
  chunk_size = 100L,
  max_tries = 5L,
  verbose = TRUE,
  credentials = NULL
)

Arguments

index

The name of the index documents should be added to.

documents

A data frame with columns title, text, date, and optional other columns. An .id column is interpreted as elastic document IDs

columns

An optional list with data types, e.g. list(author = "keyword").

chunk_size

Uploads are broken into chunks to prevent errors. Smaller chunks are less error-prone, but this also makes the upload slower.

max_tries

In case something goes wrong, how often should the function retry to send the documents?

verbose

Should a progress bar be printed during upload.

credentials

The credentials to use. If not given, uses last login information.

Value

Nothing.

Examples

## Not run: 
amcat_login("http://localhost/amcat")
docs <- data.frame(
  date = "2024-01-01",
  title = "This is a title",
  text = "This is some text"
)
create_index(index = "new_index")
upload_documents(index = "new_index",
                 documents = docs)

## End(Not run)

ccs-amsterdam/amcat4r documentation built on April 17, 2025, 3:22 a.m.